* Some changes to chat and user handling.

This commit is contained in:
LevelX2 2017-08-27 00:31:52 +02:00
parent 52897094b3
commit d024d59626
3 changed files with 13 additions and 13 deletions

View file

@ -41,7 +41,7 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
public final static int MAGE_VERSION_MAJOR = 1; public final static int MAGE_VERSION_MAJOR = 1;
public final static int MAGE_VERSION_MINOR = 4; public final static int MAGE_VERSION_MINOR = 4;
public final static int MAGE_VERSION_PATCH = 26; public final static int MAGE_VERSION_PATCH = 26;
public final static String MAGE_VERSION_MINOR_PATCH = "V1"; public final static String MAGE_VERSION_MINOR_PATCH = "V2";
public final static String MAGE_VERSION_INFO = ""; public final static String MAGE_VERSION_INFO = "";
private final int major; private final int major;

View file

@ -86,19 +86,17 @@ public enum ChatManager {
if (chatId != null) { if (chatId != null) {
ChatSession chatSession = chatSessions.get(chatId); ChatSession chatSession = chatSessions.get(chatId);
if (chatSession != null) { if (chatSession != null) {
synchronized (chatSession) { if (chatSessions.containsKey(chatId)) {
if (chatSessions.containsKey(chatId)) { final Lock w = lock.writeLock();
final Lock w = lock.writeLock(); w.lock();
w.lock(); try {
try { chatSessions.remove(chatId);
chatSessions.remove(chatId); } finally {
} finally { w.unlock();
w.unlock();
}
logger.trace("Chat removed - chatId: " + chatId);
} else {
logger.trace("Chat to destroy does not exist - chatId: " + chatId);
} }
logger.trace("Chat removed - chatId: " + chatId);
} else {
logger.trace("Chat to destroy does not exist - chatId: " + chatId);
} }
} }
} }

View file

@ -386,6 +386,8 @@ public class User {
if (controller.isPresent()) { if (controller.isPresent()) {
ccSideboard(entry.getValue(), entry.getKey(), controller.get().getRemainingTime(), controller.get().getOptions().isLimited()); ccSideboard(entry.getValue(), entry.getKey(), controller.get().getRemainingTime(), controller.get().getOptions().isLimited());
} else { } else {
// Table is missing after connection was lost during sideboard.
// Means other players were removed or conceded the game?
logger.error("sideboarding id not found : " + entry.getKey()); logger.error("sideboarding id not found : " + entry.getKey());
} }
} }