Skip to main content
The 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 a Server 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.
Example:

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.
Example:

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.
Example:

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.
This method will only return 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 using MaintenanceProxy.getServerOrDummy(String) with a non-existent server, a DummyServer instance is returned. This implementation:
  • Returns false for hasPlayers()
  • Does nothing when broadcast() is called
  • Returns false for isRegisteredServer()
  • Returns the provided name from getName()
This allows you to write code without null checks while still being able to detect unregistered servers.

Complete Usage Example

See Also