Solved Getting Player ping in 1.16.4

Discussion in 'Plugin Development' started by qtimexdel, Nov 18, 2020.

  1. Offline


    Hey everyone
    I know that this got asked alot.
    I also found alot stuff for that.

    But for most of the time i found something like that:
    ((CraftPlayer) player).getHandle().ping;
    so basically casting a player into a CraftPlayer and use getHandle().ping to get the players ping as integer.
    That also worked in some of my older plugins from 1.8 or something

    currently I'm using the version 1.16.4-R0.1-SNAPSHOT from the spigot-api
    But i can't find a CraftPlayer... has it got renamed or something?
    And in case that is outdated is there another way to get the players ping?

    Last edited: Nov 19, 2020
  2. Offline


  3. Offline


    The CraftPlayer class still exists, but the import has been renamed.
  4. Offline


    Thank you guys for the response.

    then what is the new name for CraftPlayer?
    I mean normaly its just changing by the version name

    But I still cant find it

    @Kars imma try that thank you
    But for me it looks like the is kinda doing the same as me but just with the addition that he imports the class via the version name of bukkit. For my plugin it can stay on that version but i cant import it so yea I think that should then also not work

    ok never mined that PingUtil worked fine for me :D thank you for the responses :D
    Last edited: Nov 19, 2020

Share This Page