Get a player's ping with Bukkit?

Discussion in 'Plugin Development' started by MomsKnife, Aug 7, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    MomsKnife

    I'm having difficulty getting a player's ping with bukkit(not craftbukkit), any suggestions?
     
  2. Offline

    fireblast709

    MomsKnife I don't think you can (with Bukkit alone at least, and no, not counting reflection as 'Bukkit alone')
     
  3. Offline

    RawCode

    check network protocol for packets that require client side answer, sent such packet and monitor answer arrival, this will be your ping.

    there are atleast 4 such packets.
     
  4. Offline

    MCForger

  5. Offline

    MomsKnife

  6. Offline

    Gamecube762

    Its not. Player doesn't have a method for it.
     
  7. Offline

    Garris0n

    He said with Bukkit, which is not possible.

    Also, you should just use NMS. Using reflection purely to avoid the version barrier is a bad idea.
     
  8. Offline

    rbrick

    o right. welp. i got nothing :p
     
  9. Offline

    qlimax5000

    MomsKnife
    Code:java
    1. // CraftBukkit needed //
    2. public int getPing(Player player) {
    3. return ((CraftPlayer) player).getHandle().ping;
    4. }
     
  10. Offline

    _LB

    qlimax5000
     
  11. Offline

    qlimax5000

    _LB
     
  12. Offline

    Garris0n

    I was saying he should use plain NMS instead of using reflection to avoid a CB dependency. I was not saying the OP should use NMS, although what he wants to do is not possible with the Bukkit API.
     
  13. Offline

    qlimax5000

    Garris0n
    I know, i was just showing how to do it if OP wanted it.
     
Thread Status:
Not open for further replies.

Share This Page