SpigotMC / BungeeCord

BungeeCord, the 6th in a generation of server portal suites. Efficiently proxies and maintains connections and transport between multiple Minecraft servers.
https://www.spigotmc.org/go/bungeecord
Other
1.58k stars 1.11k forks source link

Add API to modify the Minecraft-Query-Result #2416

Open Chritox opened 6 years ago

Chritox commented 6 years ago

Hey there,

while it is very simple to change the Data shown in the Minecraft Client if a server gets pinged it is not possible to modify the results, that a minecraft query connection brings unless you modify Bungeecord.

With this Post I am asking for the creation of a suitable API to handle that easily (maybe sth. like QueryEvent)

Best Regards BloodSKreaper

AlexDicy commented 6 years ago

You can easily change the Ping Data shown in the multiplayer server list using the ProxyPingEvent

@EventHandler
public void onPing(ProxyPingEvent event) {
    ServerPing serverPing = event.getResponse();

    int online = 10; // filled slots
    int max = 20; // slots
    serverPing.setPlayers(new ServerPing.Players(online, max, null)); // If you want to change the slots count
    serverPing.setDescriptionComponent(new TextComponent("Your motd here"));
    event.setResponse(serverPing);
}

But you can't modify Query Data unless you use reflection (try with QueryHandler.java)