Check if account has more than one IP?

Discussion in 'Plugin Development' started by Trevor1134, Jun 28, 2013.

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

    Trevor1134

    I want to be able to run /ipcheck <user> and if they have more than one account with that IP it returns saying the other IP accounts. Is this possible? How do I check if a user has more than one account on an IP?
     
  2. Offline

    caseif

    You would need to log the IP of an account every time it connects, then get all indices from the database with the IP you want to check for.
     
  3. Well to check the ip you could do this .

    Code:java
    1. Player s = (Player)sender;
    2. Player target = sender.getServer().getPlayer(args[0]);
    3. TargetIp = target.getAddress();
    4. InetSocketAddress = TargetIp;
    5. targetname = target.getDisplayName();
    6. s.sendMessage(targetname + ": " + targetIp);
     
  4. Offline

    Minnymin3

    Don't do target.getDisplayName() as players don't have display names unless a plugin sets it (like essential's /nick function). Do target.getName()
     
  5. Offline

    skipperguy12

    Minnymin3
    I don't usually ever use getDisplayName(), but doesn't it return the players name if a display name hasn't been set? Not sure, but I think it does.
     
  6. Offline

    Minnymin3

    No it throws an NPE (im pretty sure)
     
  7. Offline

    skipperguy12

    Minnymin3
    Ok, thanks for that then! I never really figured out what it did, I just always see people using it when getName() can be used :p
     
  8. Offline

    Minecrell

    Jozeth likes this.
  9. Offline

    SgtPunishment

    The only issue I can see here is users with dynamic ip addresses as their ip will change after x days
     
  10. Offline

    Jozeth

    And turning off their router will change their IP address.
    - http://whatismyipaddress.com/change-ip
     
  11. Offline

    Minnymin3

    My IP that is used publicly has not changed for over a year. My router is restarted daily because its crap.
     
  12. Offline

    Jozeth

    You might have a static IP.
     
  13. Offline

    Minnymin3

    Ya. Yay for static IPs! They make hosting servers really easy.
     
    Jozeth likes this.
  14. Offline

    LucasEmanuel

    Jozeth
    Restarting the router (releasing and renewing the IP-lease from the DHCP) only changes the IP-adress if the lease-time has run out as far as I know :)
     
    Jozeth likes this.
Thread Status:
Not open for further replies.

Share This Page