Untitled

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

import ballistickemu.Lobby.LobbyServer;
import ballistickemu.Main;
import ballistickemu.Types.StickClient;
import ballistickemu.Types.StickClientRegistry;
import ballistickemu.Types.StickRoom;


public class FindRequestHandler
{
  public static void HandlePacket(StickClient client, String packet)
  {
    String playerName = packet.substring(2).replaceAll("\000", "");
    StickClient target = Main.getLobbyServer().getClientRegistry().getClientfromName(playerName);
    if (target == null)
    {
      client.writeCallbackMessage("Player " + playerName + " was not found.");
      return; }
    if (target.getLobbyStatus().booleanValue())
    {
      client.writeCallbackMessage("Player " + playerName + " is in the lobby.");
    } else if (target.getRoom() != null)
    {
      client.writeCallbackMessage("Player " + playerName + " is in the game called " + client.getRoom().getName() + ".");
    }
  }
}