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(); } }
public PlayValidator getValidPlays() { return game.getValidPlays(this); }