Solved IP Adress of a player returns the server ip adress?

Discussion in 'Spigot Plugin Development' started by Compilable, May 18, 2016.

  1. Hello everyone!

    I'm getting this *weird* error, whenever i try to execute this code:

    Code (Text):

    String IP = staff.getAddress().getAddress().getHostAddress().toString();
    // Staff is a player obv //

    System.out.print(IP);
     
    Yet, it prints out the SERVER ip address, and not the player. Any help?

    Methods i tried and did not fix the problem:

    Code (Text):
    staff.getAddress().toString();
    Code (Text):
    staff.getAddress().getAddress().toString();
    NOTE: I am not connected using localhost. It's a hosted server by ScalaCube.
     
    #1 Compilable, May 18, 2016
    Last edited: May 18, 2016
  2. Tried
    Code (Text):
    getAddress().toString();
    Didn't work.
     
  3. Thats just some bad naming...
    The first getAddress() returns an InetSocketAdress and the second returns InetAdress.

    Have you tried:
    staff.getAddress().getAddress().toString();
     
    • Useful Useful x 1
  4. Just to be sure... Are you using BungeeCord and is ipforwarding working correctly..
     
    • Agree Agree x 1
    • Useful Useful x 1
  5. I am using BungeeCord and ipforwarding is set to false.

    Does not work.
     
  6. Inkzzz

    Resource Staff

    Put IP Forwarding to true
     
    • Useful Useful x 1
    • Agree Agree x 1
    • Useful Useful x 1
  7. Common sense... Man it's good.

     
    • Funny Funny x 1
  8. Thank you all for helping me. It worked <3.
     
    • Winner Winner x 1