Beispiel #1
0
 public void handleCommand(GameCommand command) {
   command.setPlayer(this);
   try {
     PlayValidator validator = game.getValidPlays(this);
     GameState gameState = game.getGameRules().getGameState();
     if (!command.isValidCommand(validator, gameState)) {
       throw new BadCommandException("Command not valid");
     }
     game.handleCommand(command);
   } catch (BadCommandException e) {
     logger.warn("Bad command, kicking: " + e.getMessage());
     disconnect();
   }
 }
Beispiel #2
0
 public PlayValidator getValidPlays() {
   return game.getValidPlays(this);
 }