Class Documentation: BedrockStatus
Last updated
Last updated
The BedrockStatus
class is a Java utility for fetching and retrieving the status of a Minecraft Bedrock Edition server using the . It provides methods to access various server details such as online status, player count, version, MOTD, and more.
BedrockStatus(String address)
Fetches the status of a Bedrock server with a default timeout of 5 seconds.
Parameters:
address
(String): The server address (e.g., "example.com"
or "192.168.1.1:19132"
).
Throws:
IllegalArgumentException
: If the server address is null or empty.
RuntimeException
: If an error occurs during the API request.
BedrockStatus(String address, double timeout)
Fetches the status of a Bedrock server with a custom timeout.
Parameters:
address
(String): The server address.
timeout
(double, optional): The timeout in seconds for the API request. Defaults to 5.0
if not provided.
Throws:
IllegalArgumentException
: If the server address is null or empty.
RuntimeException
: If an error occurs during the API request.
isOnline()
Checks if the server is online.
Returns:
boolean
: true
if the server is online, false
otherwise.
getHost()
Gets the server's host address.
Returns:
String
: The server's host address.
getPort()
Gets the server's port.
Returns:
int
: The server's port.
getIpAddress()
Gets the server's IP address.
Returns:
String
: The server's IP address, or null
if not available.
isEulaBlocked()
Checks if the server is blocked due to EULA violations.
Returns:
boolean
: true
if the server is EULA blocked, false
otherwise.
getRetrievedAt()
Gets the timestamp when the data was retrieved.
Returns:
long
: The timestamp in milliseconds.
getExpiresAt()
Gets the timestamp when the data expires.
Returns:
long
: The timestamp in milliseconds.
getVersionName()
Gets the version name of the server.
Returns:
String
: The version name, or null
if the server is offline.
getVersionProtocol()
Gets the protocol version of the server.
Returns:
int
: The protocol version, or -1
if the server is offline.
getPlayersOnline()
Gets the number of players currently online.
Returns:
int
: The number of players online, or 0
if the server is offline.
getMaxPlayers()
Gets the maximum number of players allowed on the server.
Returns:
int
: The maximum number of players, or 0
if the server is offline.
getMotdRaw()
Gets the raw MOTD (Message of the Day) of the server.
Returns:
String
: The raw MOTD, or null
if the server is offline.
getMotdClean()
Gets the clean MOTD (Message of the Day) of the server.
Returns:
String
: The clean MOTD, or null
if the server is offline.
getMotdHtml()
Gets the HTML MOTD (Message of the Day) of the server.
Returns:
String
: The HTML MOTD, or null
if the server is offline.
getGamemode()
Gets the game mode of the server.
Returns:
String
: The game mode, or null
if the server is offline.
getServerId()
Gets the server ID.
Returns:
String
: The server ID, or null
if the server is offline.
getEdition()
Gets the edition of the server (e.g., "MCPE"
or "MCEE"
).
Returns:
String
: The server edition, or null
if the server is offline.
Ensure the server address is valid and reachable.
The API request may fail if the server is offline or the address is incorrect.
The timeout
parameter in the constructor is optional and defaults to 5.0
seconds if not provided.