Interface EtProxyAPI
public interface EtProxyAPI
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves a specific server's info by name.Retrieves the name of the current Server.Retrieves a map of server names to ServerInfo.intGets the total number of players across all servers in the proxy network.voidNotifies the network that a player has connected to a backend server.voidNotifies the network that a player has disconnected from a backend server.voidregisterMessageListener(Consumer<ChatMessageEvent> listener) Gets the event bus or listener registry for chat messages.voidRegisters a listener that is called whenever a player connects to a backend server.voidRegisters a listener that is called whenever a player disconnects from a backend server.voidRegisters a listener that is called whenever a player switches from one backend server to another.voidRegisters a listener that is called whenever a backend server goes offline.voidRegisters a listener that is called whenever a backend server comes online.voidsendChatMessage(ChatMessageEvent event) Broadcasts a chat message to all other backend servers.voidswitchPlayerToServer(UUID playerID, String targetServer) Switches the player to another server via the proxy.
-
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
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
Broadcasts a chat message to all other backend servers.- Parameters:
event- TheChatMessageEventto broadcast to all other backend servers via the proxy.
-
registerMessageListener
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 aChatMessageEventmessage whenever a chat message is received from the proxy.
-
playerConnected
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
Registers a listener that is called whenever a player connects to a backend server.- Parameters:
listener- A consumer that accepts aPlayerConnectEventcontaining the player's UUID, name, and server name.
-
playerDisconnected
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
Registers a listener that is called whenever a player disconnects from a backend server.- Parameters:
listener- A consumer that accepts aPlayerDisconnectEventcontaining the player's UUID, name, and server name.
-
registerPlayerSwitchListener
Registers a listener that is called whenever a player switches from one backend server to another.- Parameters:
listener- A consumer that accepts aPlayerSwitchEventcontaining the player's UUID, name, the server they switched from, and the server they switched to.
-
registerServerOnlineListener
Registers a listener that is called whenever a backend server comes online.- Parameters:
listener- A consumer that accepts aServerOnlineEventcontaining the name of the server that came online.
-
registerServerOfflineListener
Registers a listener that is called whenever a backend server goes offline.- Parameters:
listener- A consumer that accepts aServerOfflineEventcontaining 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
-