PingAPI 1.1

Ping easily to other servers! [API, only for plugin developers!]

  1. didjee2
    Contributors:
    didjee2
    [​IMG]
    Features:
    - Easy to ping to other servers.
    - Pinging aSync.
    - Ability to set & get the count, motd, name, max players count, version, ...
    - And even more!

    API:
    Adding a server:

    The name is recommended to be the name as in the bungeecord if possible. This returns a ServerInfo.
    Code (Text):
    Pinger.getInstance().getPingAPI().addServer(String name, String address, int port, int timeout);

    Removing a server:
    The name is the name that you define when adding the server.
    Code (Text):
    Pinger.getInstance().getPingAPI().removeServer(String name);

    Getting a server:
    The name is the name that you define when adding the server.
    Code (Text):
    Pinger.getInstance().getPingAPI().getServer(String name);

    Check if a server exists or not:
    The name is the name that you define when adding the server.
    Code (Text):
    Pinger.getInstance().getPingAPI().existsServer(String name);

    Get all registered servers:
    Returns a list of all registered servers.
    Code (Text):
    Pinger.getInstance().getPingAPI().getServers();

    Code (Text):

        new BukkitRunnable(){
          public void run(){
            if(!getPingAPI().existServer("centrixpvp")){
              ServerInfo server = getPingAPI().addServer("centrixpvp", "151.80.162.185", 25565, 4000);
              server.pingToServer();
           
              Bukkit.broadcastMessage("  ");
              Bukkit.broadcastMessage("  ");
              Bukkit.broadcastMessage("  ");
              Bukkit.broadcastMessage("  ");
              Bukkit.broadcastMessage("  ");
              Bukkit.broadcastMessage("§8§m------------------------------------------------");
              Bukkit.broadcastMessage("  ");
              Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&8| &c&lCentrixPVP &8» &e&lPinging to CentrixPVP"));
              Bukkit.broadcastMessage("  ");
              Bukkit.broadcastMessage("§8§m------------------------------------------------");

            } else {
              ServerInfo server = getPingAPI().getServer("centrixpvp");
              server.pingToServer();
       
              Bukkit.broadcastMessage("  ");
              Bukkit.broadcastMessage("  ");
              Bukkit.broadcastMessage("  ");
              Bukkit.broadcastMessage("  ");
              Bukkit.broadcastMessage("  ");
              Bukkit.broadcastMessage("§8§m------------------------------------------------");
              Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&8| &c&lCentrixPVP &8» &e&lServer Stats"));
              Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&8| &c&lCentrixPVP &8» &6Status: " + (server.isOnline() ? "&aOnline" : "&cOffline")));
              Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&8| &c&lCentrixPVP &8» &6Players: &b" + server.getPlayerCount() + "/" + server.getMaxPlayers()));  Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&8| &c&lCentrixPVP &8» &6Version: &b" + server.getVersion()));
            }
          }
        }.runTaskTimerAsynchronously(this, 0L, 100L);
     
    [​IMG]

Recent Updates

  1. PingAPI v1.1

Recent Reviews

  1. Mggame
    Mggame
    4/5,
    Version: 1.1
    1. didjee2
      Author's Response
      Could you PM me with some more info, like what's not working? The command or does it gives errors, ...
      _____________________________________
      Est-ce que tu peux PM moi acec un peu plus de informations, comme quoi ne marche pas? La commande ou as-tu un error?
      _____________________________________
      Sorry for my bad French/English, I'm Dutch.