Solved Server Ping "Ping"

Discussion in 'Plugin Development' started by BlueMustache, Aug 18, 2014.

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

    BlueMustache

    Hey Guys,
    I have a tough nut for you to crack today.
    So, here is the jiff.
    When a MC client pings a server, it says the latency between the client and the server.
    How might I get the integer of the ping latency between client and server?
    I figure you have to have the server ping the client, when ServerListPingEvent is called.
    I don't want to do it one they join, I went to ping them before they join.
    I know there is stuff on pinging with java on the internet, but it is kinda useless, since it depends on the os's command line.

    Please help (Thanks!),
    -Blue
     
  2. Offline

    stormneo7

    Code:java
    1. final Player p = (Player) sender;
    2. int ping = ((CraftPlayer)p).getHandle().ping

    You'd have to update the plugin every Minecraft update as this does use NMS.
     
    BlueMustache likes this.
  3. Offline

    _Filip

    BlueMustache likes this.
  4. Offline

    fireblast709

    BlueMustache As my fellow posters have pointed out, there is no way to measure ping before the client has an actual Player to send keepalive packets to (which include timestamps on which the ping is based).
     
    BlueMustache likes this.
  5. Offline

    BlueMustache

    all

    So, there is no way at all, outside of having an established connection?

    We can make super-colliders that are powered by homeless people on treadmills, and we can't do this? :/
     
  6. Offline

    Lactem

    I don't think all can help you, but anyway why do you need it before the player joins?
     
  7. Offline

    mythbusterma

    BlueMustache

    Because the client doesn't specify a way to respond to a packet that would allow you to effectively ping a server, although you could create a modified client that sends a packet to the server, and a Bukkit plugin to respond to it.
     
  8. Offline

    BlueMustache

    Lactem
    To help my plugin... run a few numbers.
     
  9. Offline

    Lactem

    And why can't those numbers be ran on login?
     
  10. Offline

    BlueMustache

    Lactem
    Why not before? Time Dr.Freeman?
     
  11. Offline

    Lactem

    Not before because you can't do it before.
     
  12. Offline

    xTigerRebornx

  13. Offline

    BlueMustache

    xTigerRebornx
    Thanks.
    I guess it's solved as much as it possible can be.
     
Thread Status:
Not open for further replies.

Share This Page