ServerPingerAPI

This project is abandoned and its default file will likely not work with the most recent version of Minecraft. Whether this project is out of date or its author has marked it as abandoned, this project is no longer maintained.

This is the API for my ServerPinger plugin. With this you can check the online Status of other servers, get the MOTD, Players Online, etc. To start off with, you need to include this in your java Build path.AS WELL AS COPY THE JAR INTO YOUR /plugins DIRECTORY OTHERWISE IT WILL NOT WORK! Once you've got that done, I assume you want to connect to a server, no? Well let's get on with it!

Server server = new Server("maxisociety.com", 25565);

//This one set's the ip to what you enter and the port to 25565
Server server = new Server("maxisociety.com");

//This one set's the IP to "127.0.0.1" which is localhost. And the port to 25565.
Server server = new Server();

That's it! The first argument is the IP of the server. And the second is the Port.

Now to get the Data from the other server.

String motd = server.getMOTD();
String currentOnlinePlayers = server.getPlayers();
String maxPlayers = server.getMaxPlayers();
String serverVersion = server.getVersion();

//My favorite :)
boolean isOnline = server.isOnline();

That's it! But just as a tip, always check if the server is online before you do anything. Otherwise it won't work. You can check this by doing the following:

if(!server.isOnline())
{
      //The server's offline, thus do nothing.
}else
{
      //DO ALL OF THE CODE!
}

Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    67988
  • Created
    Oct 26, 2013
  • Last Released File
    Oct 27, 2013
  • Total Downloads
    655
  • License

Categories

Members

Recent Files

Bukkit