Package ch.andre601.fluxpoint4j.request
Class MCServerPingResponse
- java.lang.Object
-
- ch.andre601.fluxpoint4j.request.MCServerPingResponse
-
- All Implemented Interfaces:
GenericAPIResponse
public class MCServerPingResponse extends java.lang.Object implements GenericAPIResponse
Class used for theMCRequestBuilder.performRequest()
andMCRequestBuilder.queueRequest()
methods.
-
-
Constructor Summary
Constructors Constructor Description MCServerPingResponse()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getCode()
The returned status code.java.lang.String
getIcon()
Gives you the URL to the server's icon.int
getMaxPlayers()
The total amount of players the server can accept.@Nullable java.lang.String
getMessage()
A possible response message.java.lang.String
getMotd()
The MOTD displayed by the server during the ping.java.lang.String[]
getPlayers()
Gives you an Array of the online player names on the server.int
getPlayersOnline()
Returns the online player count.java.lang.String
getRawIcon()
Returns the Base64-encoded image used by the server.java.lang.String
getStatus()
Returns the Status.java.lang.String
getVersion()
Returns the MC version this server is running.boolean
isFullQuerry()
Deprecated.The returned boolean instance had a typo, making it not be handled by the JSON parser.boolean
isFullQuery()
Whether this returned info is the full query.boolean
isOnline()
Returns whether the pinged server is online or not.
-
-
-
Method Detail
-
getCode
public int getCode()
The returned status code.
Anything that isn't a 2xx response should be counted as a failed request.- Specified by:
getCode
in interfaceGenericAPIResponse
- Returns:
- Status code from the API response.
-
getMessage
@Nullable public @Nullable java.lang.String getMessage()
A possible response message. This is usually empty/null value for successful responses as usually only failed ones will have a message in it.- Specified by:
getMessage
in interfaceGenericAPIResponse
- Returns:
- Possibly-empty/null message from the API response.
-
isOnline
public boolean isOnline()
Returns whether the pinged server is online or not.- Returns:
- True if the server is online, otherwise false.
-
getIcon
public java.lang.String getIcon()
Gives you the URL to the server's icon.
The URL is from mc-api.net and Fluxpoint is not affiliated nor endorsed by them.- Returns:
- String containing the Image URL to the server's icon.
-
getMotd
public java.lang.String getMotd()
The MOTD displayed by the server during the ping.- Returns:
- String containing the MOTD of the server.
-
getPlayersOnline
public int getPlayersOnline()
Returns the online player count.- Returns:
- Amount of players online on the server.
-
getMaxPlayers
public int getMaxPlayers()
The total amount of players the server can accept.- Returns:
- Total amount of players allowed on the server.
-
getVersion
public java.lang.String getVersion()
Returns the MC version this server is running.
The returned value can be anything as the server can manipulate what it returns.- Returns:
- String containing the supported version(s) for the server.
-
isFullQuerry
@Deprecated public boolean isFullQuerry()
Deprecated.The returned boolean instance had a typo, making it not be handled by the JSON parser. UseisFullQuery
instead.Whether this returned info is the full query.
Whenfalse
does it mean that certain values (i.e. theplayer list
) are empty.- Returns:
- True if all values are returned, otherwise false.
-
isFullQuery
public boolean isFullQuery()
Whether this returned info is the full query.
Whenfalse
does it mean that certain values (i.e. theplayer list
) are empty.- Returns:
- True if all values are returned, otherwise false.
-
getPlayers
public java.lang.String[] getPlayers()
Gives you an Array of the online player names on the server.
This may be empty if the server doesn't provide (hides) the players.- Returns:
- Possibly-empty String array containing the names of the online players.
-
getStatus
public java.lang.String getStatus()
Returns the Status. This can be "ok", but also something completely different.- Returns:
- Status of the server.
-
getRawIcon
public java.lang.String getRawIcon()
Returns the Base64-encoded image used by the server.
To get the icon, setwithIcon(true)
in theMCRequestBuilder
.- Returns:
- possibly-null/Empty, Base64-encoded String representing the Server's icon.
-
-