There is no need to call simple getter from the same class.

This commit is contained in:
vraskulin 2017-02-09 17:40:51 +03:00
parent 12820b54d4
commit 192110cd68
2 changed files with 12 additions and 12 deletions

View file

@ -985,11 +985,11 @@ public class TableController {
} }
public synchronized TableState getTableState() { public synchronized TableState getTableState() {
return getTable().getState(); return table.getState();
} }
public synchronized boolean changeTableStateToStarting() { public synchronized boolean changeTableStateToStarting() {
if (getTable().getState() != TableState.READY_TO_START) { if (table.getState() != TableState.READY_TO_START) {
// tournament is not ready, can't start // tournament is not ready, can't start
return false; return false;
} }
@ -997,7 +997,7 @@ public class TableController {
logger.debug("Not alle Seats are occupied: stop start tableId:" + table.getId()); logger.debug("Not alle Seats are occupied: stop start tableId:" + table.getId());
return false; return false;
} }
getTable().setState(TableState.STARTING); table.setState(TableState.STARTING);
return true; return true;
} }
} }

View file

@ -430,35 +430,35 @@ public class User {
} }
public void remove(DisconnectReason reason) { public void remove(DisconnectReason reason) {
logger.trace("REMOVE " + getName() + " Draft sessions " + draftSessions.size()); logger.trace("REMOVE " + userName + " Draft sessions " + draftSessions.size());
for (DraftSession draftSession : draftSessions.values()) { for (DraftSession draftSession : draftSessions.values()) {
draftSession.setKilled(); draftSession.setKilled();
} }
draftSessions.clear(); draftSessions.clear();
logger.trace("REMOVE " + getName() + " Tournament sessions " + userTournaments.size()); logger.trace("REMOVE " + userName + " Tournament sessions " + userTournaments.size());
for (UUID tournamentId : userTournaments.values()) { for (UUID tournamentId : userTournaments.values()) {
TournamentManager.getInstance().quit(tournamentId, getId()); TournamentManager.getInstance().quit(tournamentId, userId);
} }
userTournaments.clear(); userTournaments.clear();
logger.trace("REMOVE " + getName() + " Tables " + tables.size()); logger.trace("REMOVE " + userName + " Tables " + tables.size());
for (Entry<UUID, Table> entry : tables.entrySet()) { for (Entry<UUID, Table> entry : tables.entrySet()) {
logger.debug("-- leave tableId: " + entry.getValue().getId()); logger.debug("-- leave tableId: " + entry.getValue().getId());
TableManager.getInstance().leaveTable(userId, entry.getValue().getId()); TableManager.getInstance().leaveTable(userId, entry.getValue().getId());
} }
tables.clear(); tables.clear();
logger.trace("REMOVE " + getName() + " Game sessions: " + gameSessions.size()); logger.trace("REMOVE " + userName + " Game sessions: " + gameSessions.size());
for (GameSessionPlayer gameSessionPlayer : gameSessions.values()) { for (GameSessionPlayer gameSessionPlayer : gameSessions.values()) {
logger.debug("-- kill game session of gameId: " + gameSessionPlayer.getGameId()); logger.debug("-- kill game session of gameId: " + gameSessionPlayer.getGameId());
GameManager.getInstance().quitMatch(gameSessionPlayer.getGameId(), userId); GameManager.getInstance().quitMatch(gameSessionPlayer.getGameId(), userId);
gameSessionPlayer.quitGame(); gameSessionPlayer.quitGame();
} }
gameSessions.clear(); gameSessions.clear();
logger.trace("REMOVE " + getName() + " watched Games " + watchedGames.size()); logger.trace("REMOVE " + userName + " watched Games " + watchedGames.size());
for (UUID gameId : watchedGames) { for (UUID gameId : watchedGames) {
GameManager.getInstance().stopWatching(gameId, userId); GameManager.getInstance().stopWatching(gameId, userId);
} }
watchedGames.clear(); watchedGames.clear();
logger.trace("REMOVE " + getName() + " Chats "); logger.trace("REMOVE " + userName + " Chats ");
ChatManager.getInstance().removeUser(userId, reason); ChatManager.getInstance().removeUser(userId, reason);
} }
@ -517,11 +517,11 @@ public class User {
} }
} else { } else {
// can happen if tournamet has just ended // can happen if tournamet has just ended
logger.debug(getName() + " tournament player missing - tableId:" + table.getId(), null); logger.debug(userName + " tournament player missing - tableId:" + table.getId(), null);
tablesToDelete.add(tableEntry.getKey()); tablesToDelete.add(tableEntry.getKey());
} }
} else { } else {
logger.error(getName() + " tournament key missing - tableId: " + table.getId(), null); logger.error(userName + " tournament key missing - tableId: " + table.getId(), null);
} }
} else { } else {
switch (table.getState()) { switch (table.getState()) {