Class QueryThreadGs4

java.lang.Object
net.minecraft.server.rcon.thread.GenericThread
net.minecraft.server.rcon.thread.QueryThreadGs4
All Implemented Interfaces:
Runnable

public class QueryThreadGs4 extends GenericThread
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • GAME_TYPE

      private static final String GAME_TYPE
      See Also:
    • GAME_ID

      private static final String GAME_ID
      See Also:
    • CHALLENGE_CHECK_INTERVAL

      private static final long CHALLENGE_CHECK_INTERVAL
      See Also:
    • RESPONSE_CACHE_TIME

      private static final long RESPONSE_CACHE_TIME
      See Also:
    • lastChallengeCheck

      private long lastChallengeCheck
    • port

      private final int port
    • serverPort

      private final int serverPort
    • maxPlayers

      private final int maxPlayers
    • serverName

      private final String serverName
    • worldName

      private final String worldName
    • socket

      private DatagramSocket socket
    • buffer

      private final byte[] buffer
    • hostIp

      private String hostIp
    • serverIp

      private String serverIp
    • validChallenges

      private final Map<SocketAddress,QueryThreadGs4.RequestChallenge> validChallenges
    • rulesResponse

      private final NetworkDataOutputStream rulesResponse
    • lastRulesResponse

      private long lastRulesResponse
    • serverInterface

      private final ServerInterface serverInterface
  • Constructor Details

    • QueryThreadGs4

      private QueryThreadGs4(ServerInterface pServerInterface, int pPort)
  • Method Details

    • create

      @Nullable public static QueryThreadGs4 create(ServerInterface pServerInterface)
    • sendTo

      private void sendTo(byte[] pData, DatagramPacket pRequestPacket) throws IOException
      Sends a byte array as a DatagramPacket response to the client who sent the given DatagramPacket
      Throws:
      IOException
    • processPacket

      private boolean processPacket(DatagramPacket pRequestPacket) throws IOException
      Parses an incoming DatagramPacket, returning true if the packet was valid
      Throws:
      IOException
    • buildRuleResponse

      private byte[] buildRuleResponse(DatagramPacket pRequestPacket) throws IOException
      Creates a query response as a byte array for the specified query DatagramPacket
      Throws:
      IOException
    • getIdentBytes

      private byte[] getIdentBytes(SocketAddress pAddress)
      Returns the request ID provided by the authorized client
    • validChallenge

      private Boolean validChallenge(DatagramPacket pRequestPacket)
      Returns true if the client has a valid auth, otherwise false.
    • sendChallenge

      private void sendChallenge(DatagramPacket pRequestPacket) throws IOException
      Sends an auth challenge DatagramPacket to the client and adds the client to the queryClients map
      Throws:
      IOException
    • pruneChallenges

      private void pruneChallenges()
    • run

      public void run()
    • start

      public boolean start()
      Overrides:
      start in class GenericThread
    • recoverSocketError

      private void recoverSocketError(Exception pException)
      Stops the query server and reports the given Exception
    • initSocket

      private boolean initSocket()