/** * Sends a message to all players in the current game.<br> * The message will not be sent to players with the {@link Player#isAi} flag. * * @param message The message to be sent. */ public void sendMessageToAllPlayers(Message message) { for (Player p : players) { if (p.isAi() == false || p.getSocket() != null) { message.send(p.getSocket(), p); } } }
/** * Sends a message to the current player. The message will not be sent to players with the {@link * Player#isAi} flag. * * @param message The message to be sent. */ public void sendMessageToCurrentPlayer(Message message) { if (currentPlayer.isAi() == false) { message.send(currentPlayer.getSocket(), currentPlayer); } }
/** * Sends a message to a single player. The message will not be sent to players with the {@link * Player#isAi} flag. * * @param message The message to be sent. * @param player The player who will receive the message. */ public void sendMessageToPlayer(Message message, Player player) { if (player.isAi() == false) { message.send(player.getSocket(), player); } }