Advertisement
Walexmine

Untitled

Dec 25th, 2015
161
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package NaskiGames.PingServerAPI;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandSender;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.event.Listener;
  8. import org.bukkit.plugin.Plugin;
  9. import org.bukkit.scheduler.BukkitRunnable;
  10.  
  11. import com.dbsoftware.pingapi.Pinger;
  12. import com.dbsoftware.pingapi.ServerInfo;
  13.  
  14. public class ServerGame implements Listener{
  15.  
  16.  
  17. public boolean onCommand(CommandSender sender, Command command, String label, String[] arg1)
  18. {
  19. Player p = (Player)sender;
  20.  
  21.  
  22. if (command.getName().equalsIgnoreCase("alpha")) {
  23.  
  24. new BukkitRunnable(){
  25. public void run(){
  26. if(!Pinger.getInstance().getPingAPI().existServer("centrixpvp")){
  27. ServerInfo server = Pinger.getInstance().getPingAPI().addServer("centrixpvp", "play.epicube.fr", 25565, 4000);
  28. server.pingToServer();
  29.  
  30. Bukkit.broadcastMessage(" ");
  31. Bukkit.broadcastMessage(" ");
  32. Bukkit.broadcastMessage(" ");
  33. Bukkit.broadcastMessage(" ");
  34. Bukkit.broadcastMessage(" ");
  35. Bukkit.broadcastMessage("§8§m------------------------------------------------");
  36. Bukkit.broadcastMessage(" ");
  37. Bukkit.broadcastMessage("&8| &c&lCentrixPVP &8» &e&lPinging to CentrixPVP");
  38. Bukkit.broadcastMessage(" ");
  39. Bukkit.broadcastMessage("§8§m------------------------------------------------");
  40.  
  41. } else {
  42. ServerInfo server = Pinger.getInstance().getPingAPI().getServer("centrixpvp");
  43. server.pingToServer();
  44.  
  45. Bukkit.broadcastMessage(" ");
  46. Bukkit.broadcastMessage(" ");
  47. Bukkit.broadcastMessage(" ");
  48. Bukkit.broadcastMessage(" ");
  49. Bukkit.broadcastMessage(" ");
  50. Bukkit.broadcastMessage("§8§m------------------------------------------------");
  51. Bukkit.broadcastMessage("&8| &c&lCentrixPVP &8» &e&lServer Stats");
  52. Bukkit.broadcastMessage("&8| &c&lCentrixPVP &8» &6Status: " + (server.isOnline() ? "&aOnline" : "&cOffline"));
  53. Bukkit.broadcastMessage("&8| &c&lCentrixPVP &8» &6Players: &b" + server.getPlayerCount() + "/" + server.getMaxPlayers()); Bukkit.broadcastMessage("&8| &c&lCentrixPVP &8» &6Version: &b" + server.getVersion());
  54. }
  55. }
  56.  
  57.  
  58. }.runTaskTimerAsynchronously((Plugin) this, 0L, 100L);
  59.  
  60. }
  61. return false;
  62. }
  63.  
  64.  
  65. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement