String text = message.getMessage();
if (text.length() > 100) {
session.disconnect("Chat message too long.");
} else if (text.startsWith("/")) {
CommandManager manager = session.getServer().getCommandManager();
manager.execute(player, text);
} else {
player.getWorld().broadcastMessage("<" + player.getName() + "> " + text);
}
}