mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +00:00
merge
This commit is contained in:
commit
02188fe73a
5 changed files with 16 additions and 7 deletions
|
@ -65,7 +65,7 @@ public class ChatSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void kill(UUID userId) {
|
public void kill(UUID userId) {
|
||||||
if (clients.containsKey(userId)) {
|
if (userId != null && clients.containsKey(userId)) {
|
||||||
String userName = clients.get(userId);
|
String userName = clients.get(userId);
|
||||||
clients.remove(userId);
|
clients.remove(userId);
|
||||||
broadcast(userName, " has left", MessageColor.BLACK);
|
broadcast(userName, " has left", MessageColor.BLACK);
|
||||||
|
|
|
@ -451,8 +451,11 @@ public class MageServerImpl implements MageServer {
|
||||||
@Override
|
@Override
|
||||||
public boolean isTableOwner(String sessionId, UUID roomId, UUID tableId) throws MageException {
|
public boolean isTableOwner(String sessionId, UUID roomId, UUID tableId) throws MageException {
|
||||||
try {
|
try {
|
||||||
UUID userId = SessionManager.getInstance().getSession(sessionId).getUserId();
|
Session session = SessionManager.getInstance().getSession(sessionId);
|
||||||
return TableManager.getInstance().isTableOwner(tableId, userId);
|
if (session != null) {
|
||||||
|
UUID userId = SessionManager.getInstance().getSession(sessionId).getUserId();
|
||||||
|
return TableManager.getInstance().isTableOwner(tableId, userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
handleException(ex);
|
handleException(ex);
|
||||||
|
|
|
@ -263,7 +263,8 @@ public class TableController {
|
||||||
else {
|
else {
|
||||||
player = PlayerFactory.getInstance().createPlayer(playerType, name, options.getRange(), skill);
|
player = PlayerFactory.getInstance().createPlayer(playerType, name, options.getRange(), skill);
|
||||||
}
|
}
|
||||||
logger.info("Player created " + player.getId());
|
if (player != null)
|
||||||
|
logger.info("Player created " + player.getId());
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,8 @@ public class User {
|
||||||
public synchronized void fireCallback(final ClientCallback call) {
|
public synchronized void fireCallback(final ClientCallback call) {
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
Session session = SessionManager.getInstance().getSession(sessionId);
|
Session session = SessionManager.getInstance().getSession(sessionId);
|
||||||
session.fireCallback(call);
|
if (session != null)
|
||||||
|
session.fireCallback(call);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,11 +217,15 @@ public class TournamentController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void submitDeck(UUID playerId, Deck deck) {
|
public void submitDeck(UUID playerId, Deck deck) {
|
||||||
tournamentSessions.get(playerId).submitDeck(deck);
|
if (tournamentSessions.containsKey(playerId)) {
|
||||||
|
tournamentSessions.get(playerId).submitDeck(deck);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDeck(UUID playerId, Deck deck) {
|
public void updateDeck(UUID playerId, Deck deck) {
|
||||||
tournamentSessions.get(playerId).updateDeck(deck);
|
if (tournamentSessions.containsKey(playerId)) {
|
||||||
|
tournamentSessions.get(playerId).updateDeck(deck);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void timeout(UUID userId) {
|
public void timeout(UUID userId) {
|
||||||
|
|
Loading…
Reference in a new issue