IP Address

Discussion in 'Plugin Development' started by DoggyCode™, Jul 5, 2015.

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

    DoggyCode™

    Ok, so I'm creating this custom ban system. I want a command that checks a player's IP Address ('/checkip'). I tried using "p.getAddress().toString()", but it just gives me the wrong IP Address. Has anyone done this before? I know it's possible.
     
  2. @DoggyCode™ Pretty sure it's p.getAddress().getAddress().toString()
     
  3. @DoggyCode™
    Code:
    p.getAddress().getAddress().getHostAddress();
     
  4. Offline

    DoggyCode™

    No, that's wrong... Just tried
     
  5. Offline

    DoggyCode™

    You see, I don't want the IPv4 Address, I want like the IP Address you can get at sites like https://www.whatismyip.com/
     
  6. @DoggyCode™ I don't know what you think that site provides you; but thats either ipv4 or ipv6.

    Anyways, if you want to do the same as that site: do what @Assist or @bwfcwalshy suggested you. Note that they do: "p.getAddress().getAddress()" - aka getAddress() twice.
     
  7. Offline

    DoggyCode™

    Lol, that only got me the Player's computer name xD @bwfcwalshy
     
Thread Status:
Not open for further replies.

Share This Page