[SOLVED] Get client version

Discussion in 'Spigot Plugin Development' started by Amico500, Sep 6, 2014.

  1. Hi! Is there any way I could get the connected clients version? I want to only send certain things to 1.8 users. :)
     
    • Agree Agree x 1
  2. The handshake packet (first packet send by the client at login) contains a protocol version number.
    Here are the corresponding number for each version :
    • 1.7.2 - 4
    • 1.7.6 - 5
    • 1.8 - 47
    For more informations, go there : http://wiki.vg/Protocol#Handshake
     
    • Informative Informative x 1
  3. You can also get the protocol version of a client using the NetworkManager if you have the player:
    Code (Java):
    Player player;
    if (((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion() >= 47) {
        // 1.8
    }
     
    • Agree Agree x 2
    • Like Like x 1
  4. Thanks very much :) Will try them out now <3
     
    • Agree Agree x 1
    • Funny Funny x 1
  5. Yeh, I was using an old version, although I am compiling using eclipse now and not my build server since it can't get the 1.8 snapshot jars anymore :(
     
    • Informative Informative x 1