Class ConnectionRegistry

java.lang.Object
com.hypixel.hytale.server.core.io.ConnectionRegistry

public final class ConnectionRegistry extends Object
Tracks connections by account for lookups, bans, and kicks. PacketHandler adds, replaces, and removes handlers as connections change.

Each account has an immutable connection snapshot. Disconnect callbacks run without holding registry locks.

  • Method Details

    • get

      @Nonnull public static ConnectionRegistry get()
    • disconnect

      public int disconnect(@Nonnull UUID uuid, @Nonnull Message reason)
      Requests disconnection for a snapshot of the account's connections. Connections added after the snapshot are not included. A failed request does not prevent the remaining requests.
      Parameters:
      uuid - the account to disconnect
      reason - the reason sent to each connection
      Returns:
      the number of disconnect calls that returned without throwing
    • findProfile

      @Nullable public ProfileServiceClient.PublicGameProfile findProfile(@Nonnull String input)
      Resolves a connected account by a raw UUID or by name.
      Parameters:
      input - a UUID string, or a name to match by the rules of NameMatching
      Returns:
      the account of a live connection, or null if none matches
    • getConnectedUsernames

      @Nonnull public Set<String> getConnectedUsernames()
      Returns:
      a new set of usernames for tracked accounts