Class ServerManager

All Implemented Interfaces:
CommandOwner

public class ServerManager extends JavaPlugin
  • Field Details

  • Constructor Details

  • Method Details

    • get

      public static ServerManager get()
    • init

      public void init()
    • unbindAllListeners

      public void unbindAllListeners()
      Called when the HytaleServer or Universe is shutdown. Unbinds all socket listeners, preventing new players from joining.
    • getListeners

      @Nonnull public List<ServerListener> getListeners()
    • bind

      public CompletableFuture<Integer> bind(@Nonnull InetSocketAddress address)
      Binds a listener, or one per address family when the address names no interface.

      Port 0 asks the operating system to choose one, and it chooses again for every socket. The first socket that binds therefore decides the port and the others follow it. Left to pick their own, the families would listen on different ports, and a host can only advertise one.

      Returns:
      the port the listeners bound to, or 0 when none of them bound
    • unbind

      public boolean unbind(@Nonnull ServerListener channel)
    • getLocalOrPublicAddress

      @Nullable public InetSocketAddress getLocalOrPublicAddress() throws SocketException
      Throws:
      SocketException
    • getNonLoopbackAddress

      @Nullable public InetSocketAddress getNonLoopbackAddress() throws SocketException
      Throws:
      SocketException
    • getPublicAddress

      @Nullable public InetSocketAddress getPublicAddress() throws SocketException
      Throws:
      SocketException
    • waitForBindComplete

      public void waitForBindComplete()
    • registerSubPacketHandlers

      public void registerSubPacketHandlers(@Nonnull Function<IPacketHandler, SubPacketHandler> supplier)
    • populateSubPacketHandlers

      public void populateSubPacketHandlers(@Nonnull GamePacketHandler packetHandler)