CanaryModTeam / CanaryLib

The CanaryMod API Library
http://canarymod.net
28 stars 22 forks source link

Improve ServerListPingHook #69

Closed jamierocks closed 9 years ago

jamierocks commented 9 years ago

Required API for ServerListPlus

They are already crossed off if Canary has that functionality.

darkdiplomat commented 9 years ago

Hide players (leave out player counts and sample completely, renders as ??? on the client) You can modify the List<GameProfile> https://github.com/CanaryModTeam/CanaryLib/blob/master/src/main/java/net/canarymod/hook/system/ServerListPingHook.java#L125

jamierocks commented 9 years ago

But will they render as ???

darkdiplomat commented 9 years ago

theres nothing server side that says that it would, i guess sending null profile would cause the ???

stephan-gh commented 9 years ago

You can't really modify the profiles in there (without reflection) because you pass in Arrays.ArrayList, which doesn't allow adding new entries: https://github.com/CanaryModTeam/CanaryMod/blob/1.7.10-1.1.3/src/main/java/net/minecraft/server/network/NetHandlerStatusServer.java#L46

The hidden player count works by leaving out the player section in the response completely, the client will check this and display ??? instead of the player count.

darkdiplomat commented 9 years ago

for Version Name, Server.getServerVersion would do (we don't do protocol hacks nor do I intend to allow any protocol hacks or changing the version/protocol displayed)

jamierocks commented 9 years ago

Never mind, could you add something in to get the 'Protocol version of client'?

darkdiplomat commented 9 years ago

Working on finding it and getting the information passed through

stephan-gh commented 9 years ago

The protocol version of the client and the virtual host gets passed to the server in the Handshake packet. I'm not sure if the server saves it anywhere: http://wiki.vg/Protocol#Handshake

jamierocks commented 9 years ago

Also the ability to get the IP and port used to connect to the server, also in the Handshake packet.

jamierocks commented 9 years ago

Even if you do not want to allow modifying the version name and protocol version, would you allow plugins to hide the player count, you could do this fairly easy. eg the plugin could setPlayer to null, you could check for that and remove the players field in the handshake packet (if it is null).