Interface EtProxyAPI


public interface EtProxyAPI
  • Method Details

    • getServers

      Map<String, ServerInfo> getServers()
      Retrieves a map of server names to ServerInfo.
      Returns:
      A map where the key is the server name and the value is the corresponding ServerInfo object.
    • getServer

      ServerInfo getServer(String name)
      Retrieves a specific server's info by name.
      Parameters:
      name - The name of the server to retrieve information for.
      Returns:
      The ServerInfo object corresponding to the specified server name, or null if no such server exists.
    • getServerName

      String getServerName()
      Retrieves the name of the current Server.
      Returns:
      The String containing the server name.
    • sendChatMessage

      void sendChatMessage(ChatMessageEvent event)
      Broadcasts a chat message to all other backend servers.
      Parameters:
      event - The ChatMessageEvent to broadcast to all other backend servers via the proxy.
    • registerMessageListener

      void registerMessageListener(Consumer<ChatMessageEvent> listener)
      Gets the event bus or listener registry for chat messages. The provided listener will be called with the message content whenever a chat message is received from the proxy.
      Parameters:
      listener - A consumer that accepts a ChatMessageEvent message whenever a chat message is received from the proxy.
    • playerConnected

      void playerConnected(PlayerConnectEvent event)
      Notifies the network that a player has connected to a backend server.
      Parameters:
      event - The player connection event containing the player's UUID, name, and the server they connected to.
    • registerPlayerConnectListener

      void registerPlayerConnectListener(Consumer<PlayerConnectEvent> listener)
      Registers a listener that is called whenever a player connects to a backend server.
      Parameters:
      listener - A consumer that accepts a PlayerConnectEvent containing the player's UUID, name, and server name.
    • playerDisconnected

      void playerDisconnected(PlayerDisconnectEvent event)
      Notifies the network that a player has disconnected from a backend server.
      Parameters:
      event - The player disconnection event containing the player's UUID, name, and the server they disconnected from.
    • registerPlayerDisconnectListener

      void registerPlayerDisconnectListener(Consumer<PlayerDisconnectEvent> listener)
      Registers a listener that is called whenever a player disconnects from a backend server.
      Parameters:
      listener - A consumer that accepts a PlayerDisconnectEvent containing the player's UUID, name, and server name.
    • registerPlayerSwitchListener

      void registerPlayerSwitchListener(Consumer<PlayerSwitchEvent> listener)
      Registers a listener that is called whenever a player switches from one backend server to another.
      Parameters:
      listener - A consumer that accepts a PlayerSwitchEvent containing the player's UUID, name, the server they switched from, and the server they switched to.
    • registerServerOnlineListener

      void registerServerOnlineListener(Consumer<ServerOnlineEvent> listener)
      Registers a listener that is called whenever a backend server comes online.
      Parameters:
      listener - A consumer that accepts a ServerOnlineEvent containing the name of the server that came online.
    • registerServerOfflineListener

      void registerServerOfflineListener(Consumer<ServerOfflineEvent> listener)
      Registers a listener that is called whenever a backend server goes offline.
      Parameters:
      listener - A consumer that accepts a ServerOfflineEvent containing the name of the server that went offline.
    • getTotalPlayerCount

      int getTotalPlayerCount()
      Gets the total number of players across all servers in the proxy network.
      Returns:
      The total number of players currently connected across all servers in the proxy network.
    • switchPlayerToServer

      void switchPlayerToServer(UUID playerID, String targetServer)
      Switches the player to another server via the proxy.
      Parameters:
      playerID - The unique identifier of the player to switch.
      targetServer - The name of the target server to switch to.