Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.4 kB
2
Indexable
Never
package ballistickemu.Lobby.handlers;

import ballistickemu.Lobby.LobbyServer;
import ballistickemu.Main;
import ballistickemu.Tools.StickPacketMaker;
import ballistickemu.Types.StickClient;
import ballistickemu.Types.StickRoom;


public class GeneralChatHandler
{
  public static void HandlePacket(StickClient paramStickClient, String paramString)
  {
    if (paramStickClient != null)
    {

      if (paramString.substring(1).startsWith("!"))
      {
        PlayerCommandHandler.HandlePacket(paramStickClient, paramString.substring(1));
        return;
      }
      
      if (paramString.substring(1, 3).equalsIgnoreCase("::"))
      {
        ModCommandHandler.ProcessModCommand(paramStickClient, paramString.substring(1).replaceAll("\000", ""));
        return;
      }
      
      if (paramStickClient.getMuteStatus().booleanValue())
      {
        paramStickClient.writeCallbackMessage("SERVER MESSAGE: Unable to send chat message as you have been muted.");
        return;
      }
      String str1 = paramStickClient.getUID();
      String str2 = paramString.substring(1);
      if (paramStickClient.getLobbyStatus().booleanValue()) {
        Main.getLobbyServer().BroadcastPacket(StickPacketMaker.GeneralChat(str1, str2));
      } else {
        paramStickClient.getRoom().BroadcastToRoom(StickPacketMaker.GeneralChat(str1, str2));
      }
    }
  }
}