Class Documentation: Icon
Last updated
Last updated
The Icon
class is a Java utility for retrieving the server icon of a Minecraft Java Edition server using the . It provides methods to fetch the server icon as a BufferedImage
or as a URL.
getServerIcon(String address)
Retrieves the server icon as a BufferedImage
with a default timeout of 5 seconds.
Parameters:
address
(String): The server address (e.g., "example.com"
or "192.168.1.1:25565"
).
Returns:
BufferedImage
: The server icon as a BufferedImage
, or null
if an error occurs.
getServerIcon(String address, double timeout)
Retrieves the server icon as a BufferedImage
with a specified 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.
Returns:
BufferedImage
: The server icon as a BufferedImage
, or null
if an error occurs.
getServerIconAsLink(String address)
Retrieves the URL of the server icon with a default timeout of 5 seconds.
Parameters:
address
(String): The server address.
Returns:
String
: The URL of the server icon.
getServerIconAsLink(String address, double timeout)
Retrieves the URL of the server icon with a specified 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.
Returns:
String
: The URL of the server icon.
BufferedImage
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 methods is optional and defaults to 5.0
seconds if not provided.