Skip to content

WelsyMC/MinecraftServerInformations

Repository files navigation

MinecraftServerInformations

Maintenance Maintaner GitHub version

MinecraftServerInformation is a java library for retrieving informations about Minecraft Servers.

Installation

  1. Download the latest version from the Releases tab
  2. Add the .jar to your project libraries

Usage

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
    }
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

A library that provide informations for minecraft servers (players, maxplayers and motd)

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages