Player name with ServerListPingEvent

Discussion in 'Spigot Plugin Development' started by Sletonn, Dec 8, 2018.

  1. Hello, I was wondering if it is possible to get the player's name in the ServerListPingEvent. I've already think about many ways, like storing ip and name when player's connect, then getting it back on the event call. But I found 2 problems.

    Problem 1:
    What is 2 players are brothers and of course have the same ip... I know that each client has a different port, but is it unique ? If they reconnect later will have the same port than before ?

    Problem 2:
    I can't get the player's name if he's never joined the server before...
  2. ServerListPingEvent only sends server data (motd, ping, playercount, server icon, server version) to an ip. There is no way to retrieve who that ip is linked to.
  3. So the problem 2 will eternally be a problem, but what about the problem 1 ?
  4. The IP address does not have to be static for computers. Moreover, the IP address can be the same for multiple computers if they are connected to the same router. In other words, you are unable to identify a computer by its IP address.

    However, the MAC address wil also be used to transfer the packets. This address will not change over time, and thus can be used to identify a device. However, a specific device can still use two different accounts, so it may not work exactly. Moreover, it will be very hard, if not impossible, to get this information.

    It will be impossible to uniquely identify a user using the server ping packet.
    The best solution would be to use the MAC address as this is unique for every device.
    The second best solution would be to use the IP address.
  5. md_5

    Administrator Developer

    Impossible over the internet
    And no solution to either, sorry!
  6. Well, thank you. At least I learned many things :)

Share This Page