Modify ProxyPingEvent to change shown version

Discussion in 'BungeeCord Plugin Development' started by MCShamrock, Jun 28, 2013.

  1. Hi there.
    I want to modify the ProxyPing that the bungee-proxy sends for the client's server list.
    How can I modify the whole ProxyPing that is sent on the ProxyPingEvent?
    Please note that I need to modify the WHOLE ProxyPing.

    And how exactly can I create a bungee plugin that is installed on the bungee-proxy?
     
  2. md_5

    Administrator Developer

    Use .setResponse or whatever the method is called.
     
    • Informative Informative x 2
    • Like Like x 1
  3. PHP:
     @EventHandler
    public void ProxyPingEvent(ProxyPingEvent ev) {
    ServerPing r = ev.getResponse();
    Byte protocolVersion = Byte.valueOf(r.getProtocolVersion());
    String gameVersion = r.getGameVersion();
    String motd = r.getMotd();
    int currentPlayers = Integer.valueOf(r.getCurrentPlayers());
    int maxPlayers = Integer.valueOf(r.getMaxPlayers());
    ServerPing BF = new ServerPing(protocolVersion.byteValue(), gameVersion, motd, currentPlayers, maxPlayers);
    ev.setResponse(BF);
    }
    }
     
    • Like Like x 3
    • Informative Informative x 1