Solved Get player IP Address

Discussion in 'Plugin Development' started by DarkBlood9000, Aug 22, 2014.

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

    DarkBlood9000

    Hello, I saw plugins like essentials has /seen (player) which shows the player IP address, how can I get the IP of a player, I already tried this but it shows "127.0.0.1" this isn't the real ip it just means localhost


    this is the code i used

    Code:
    String ipaddress = playerToGet.getAddress().getAddress().getHostAddress().toString();
     
  2. Offline

    stormneo7

    Well are you running this on an online server or on localhost?...
     
  3. Offline

    Necrodoom

    Yes, and since you probably used it on yourself, logging to your own server, it would show 127.0.0.1.
     
  4. Offline

    DarkBlood9000

    stormneo7 Necrodoom

    It was on my test server on my pc, mm Does that mean If i run it on a hosted server it will show real ip?
    Not sure if thats what u meant
     
  5. Offline

    fireblast709

    DarkBlood9000 If you join through 'localhost', it will show localhost (or 127.0.0.1, as you can see in your case), since you 'never leave your computer' network-wise. If you have to use an external IP ('hosted server'), it will show your real IP.
     
  6. Offline

    Necrodoom

    DarkBlood9000 Yes.
    Of course getting the IP of yourself on local will generate 127.0.0.1, thats the actual IP of yourself connecting. Connect to a non-local server and it will give you the external IP.
     
  7. Offline

    DarkBlood9000

    Ok guys thanks for telling me!
    :D
     
Thread Status:
Not open for further replies.

Share This Page