MinecraftServerInformation is a java library for retrieving informations about Minecraft Servers.
- Download the latest version from the Releases tab
- Add the .jar to your project libraries
class Test{
void retrievePaladiumInfos(){
AServer server = MinecraftServerInformations.INSTANCE.getBuilder()
.host("proxy.paladium-pvp.fr")
.port(25565)
.onPingSuccess(this::serverPinged)
.build();
/*
* Threading.THREADING = Use a separated thread (asynchronously call the onPingSuccess method)
* Threading.NO_THREADING = Don't use a separated thread (the current thread will wait for the ping to finish)
*/
server.ping(Threading.THREADING);
}
public void serverPinged(ServerInformations infos){
int players = infos.getPlayers();
int maxPlayers = infos.getMaxPlayers();
String motd = infos.getMotd();
// do whatever you want
}
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.