Server interface provides an abstraction for backend servers in a proxy network, allowing you to interact with servers regardless of the underlying proxy platform (BungeeCord, Velocity, etc.).
Interface
Obtaining a Server Instance
You cannot directly instantiate aServer object. Instead, obtain instances through the MaintenanceProxy interface:
Methods
getName
Returns the name of the server.String
The name of the server as registered in the proxy configuration.
hasPlayers
Checks if there are currently any players connected to the server.boolean
true if one or more players are on the server, false otherwise.broadcast
Sends a message to all players currently connected to the server.Component
required
The Adventure Component message to broadcast to all players on the server.
isRegisteredServer
Checks whether the server is currently registered under the proxy.boolean
true if the server is registered in the proxy, false if it’s a dummy server.false if maintenance was previously enabled on a server that has since been removed from the proxy configuration. This typically happens when using MaintenanceProxy.getServerOrDummy(String) with a non-existent server name.
Example:
DummyServer Implementation
When usingMaintenanceProxy.getServerOrDummy(String) with a non-existent server, a DummyServer instance is returned. This implementation:
- Returns
falseforhasPlayers() - Does nothing when
broadcast()is called - Returns
falseforisRegisteredServer() - Returns the provided name from
getName()
Complete Usage Example
See Also
- MaintenanceProxy Interface - Proxy-specific maintenance API
- Maintenance Interface - Base maintenance API