Untitled

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

import ballistickemu.Lobby.handlers.BuyItemRequestHandler;
import ballistickemu.Lobby.handlers.CheckCapacityHandler;
import ballistickemu.Lobby.handlers.CreateRoomHandler;
import ballistickemu.Lobby.handlers.FindRequestHandler;
import ballistickemu.Lobby.handlers.GeneralChatHandler;
import ballistickemu.Lobby.handlers.GenericSendDataHandler;
import ballistickemu.Lobby.handlers.GiveTicketHandler;
import ballistickemu.Lobby.handlers.InventoryRequestHandler;
import ballistickemu.Lobby.handlers.LoginHandler;
import ballistickemu.Lobby.handlers.MapCycleRequestHandler;
import ballistickemu.Lobby.handlers.ModBanHandler;
import ballistickemu.Lobby.handlers.ModWarnHandler;
import ballistickemu.Lobby.handlers.NewClientHandler;
import ballistickemu.Lobby.handlers.RoomDetailRequestHandler;
import ballistickemu.Lobby.handlers.RoomRequestHandler;
import ballistickemu.Lobby.handlers.SetActiveItemRequestHandler;
import ballistickemu.Types.StickClient;


public class PacketHandlerLobby
{
  public static void HandlePacket(String paramString, StickClient paramStickClient)
  {
    if (paramString.length() < 2) { return;
    }
    
    if (paramString.substring(0, 1).equalsIgnoreCase("0"))
    {
      if (paramString.substring(0, 2).equalsIgnoreCase("08"))
      {
        CheckCapacityHandler.HandlePacket(paramStickClient);
      }
      else {
        if (paramString.substring(0, 2).equalsIgnoreCase("09"))
        {
          LoginHandler.HandlePacket(paramStickClient, paramString);
          paramStickClient.writeAnnounce("Server has been updated lately! Updated server version by Michal.");
          return;
        }
        
        if (paramString.substring(0, 2).equalsIgnoreCase("0\000")) {
          return;
        }
        if (paramString.substring(0, 2).equalsIgnoreCase("01"))
        {
          RoomRequestHandler.handlePacket(paramStickClient);
          return;
        }
        

        if (paramString.substring(0, 2).equalsIgnoreCase("03"))
        {
          NewClientHandler.HandlePacket(paramStickClient, paramString);
          return;
        }
        
        if (paramString.substring(0, 2).equalsIgnoreCase("00"))
        {
          GenericSendDataHandler.HandlePacket(paramStickClient, paramString);
          return;
        }
        
        if (paramString.substring(0, 2).equalsIgnoreCase("02"))
        {
          CreateRoomHandler.HandlePacket(paramStickClient, paramString);
          return;
        }
        
        if (paramString.substring(0, 2).equalsIgnoreCase("0a"))
        {
          GiveTicketHandler.HandlePacket(paramStickClient, paramString);
          return;
        }
        
        if (paramString.substring(0, 2).equalsIgnoreCase("0e"))
        {
          ModBanHandler.HandlePacket(paramStickClient, paramString);
          return;
        }
        
        if (paramString.substring(0, 2).equalsIgnoreCase("04"))
        {
          RoomDetailRequestHandler.HandlePacket(paramStickClient, paramString);
          return;
        }
        
        if (paramString.substring(0, 2).equalsIgnoreCase("06"))
        {
          MapCycleRequestHandler.HandlePacket(paramStickClient, paramString);
          return;
        }
        
        if (paramString.substring(0, 2).equalsIgnoreCase("0d"))
        {
          SetActiveItemRequestHandler.HandlePacket(paramStickClient, paramString);
          return;
        }
        if (paramString.substring(0, 2).equalsIgnoreCase("0b"))
        {
          BuyItemRequestHandler.HandlePacket(paramStickClient, paramString);
          return;
        }
        if (paramString.substring(0, 2).equalsIgnoreCase("0c"))
        {
          InventoryRequestHandler.HandlePacket(paramStickClient, paramString);
          return;
        }
        if (paramString.substring(0, 2).equalsIgnoreCase("0g"))
        {
          ModWarnHandler.HandlePacket(paramStickClient, paramString);
          return;
        }
        if (paramString.substring(0, 2).equalsIgnoreCase("0h"))
        {
          FindRequestHandler.HandlePacket(paramStickClient, paramString);
        }
      }
    }
    else {
      if (paramString.substring(0, 1).equalsIgnoreCase("9"))
      {
        GeneralChatHandler.HandlePacket(paramStickClient, paramString);
        return;
      }
      
      return;
    }
  }
}