@Override
  public void handleServer(ServerSession session, PlayerChatMessage message) {
    if (!session.hasPlayer()) {
      return;
    }

    Player player = session.getPlayer();
    String text = message.getMessage().trim();
    if (text.length() > 100) {
      text = text.substring(0, 99);
    }

    String command;
    String[] args;

    if (text.startsWith("/")) {
      command = text.split(" ")[0].replaceFirst("/", "");
      int argsIndex = text.indexOf(" ") + 1;
      args = argsIndex > 0 ? text.substring(argsIndex).split(" ") : new String[0];
    } else {
      command = "say";
      args = text.split(" ");
    }

    player.processCommand(command, args);
  }
 @Override
 public void handleClient(ClientSession session, PlayerChatMessage message) {
   if (!session.hasPlayer()) {
     return;
   }
   session.getPlayer().sendMessage(message.getMessage());
 }