13141516171819
} @Override public ChatMessage decode(ChannelBuffer buffer) { String message = ChannelBufferUtils.readString(buffer); return new ChatMessage(message); }
100101102103104105106107108
/** * Broadcasts a message to every player. * @param text The message text. */ public void broadcastMessage(String text) { ChatMessage message = new ChatMessage(text); for (Player player : getPlayers()) player.getSession().send(message); }
84858687888990
/** * A convenience method for sending a message to this player. * @param message The message. */ public void sendMessage(String message) { session.send(new ChatMessage(message)); }