1.16.x How to get version of player

Discussion in 'Spigot Plugin Development' started by Poofyjerry, Sep 16, 2020.

  1. I am not using Bungee cord. But I am using multiple worlds and I am also using via version and via backwards to allow players from 1.13 - 1.16 to join. I want to let people from 1.13 - 1.16 join the kitpvp but I don't want to let them join my survival world because the world is in 1.16 so I only want 1.16 players joining the survival world so that via version doesn't have to try to make the entire 1.16 world work for someone in 1.13.

    This is what I tried but I get an error saying the method isnt defined.
    upload_2020-9-16_13-1-49.png
     
  2. Choco

    Moderator

    Doesn't matter. Anything you get from the server to get a player's version will always be that of the server. Use ViaVersion's API.
    https://jd.viaversion.com/us/myles/ViaVersion/api/ViaAPI.html#getPlayerVersion-T-
    Code (Java):
    Via.getAPI().getPlayerVersion(player)
    Protocol versions can be found on wiki.vg
     
    • Like Like x 1
  3. Would I have to build bath of my plugin to the Via Versions jar to use their API? I have never used another plugins methods like that