Get the IP which the player used to connect

Discussion in 'Plugin Development' started by Iervolino, Sep 15, 2013.

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

    Iervolino

    Is it possible?
     
  2. Iervolino
    somePlayer.getAddress().getAddress().getHostAddress()
     
  3. Offline

    Technius

    Code:
    player.getAddress().getAddress(); //Returns an InetAddress
    
    Edit: Aww, I got ninja'd!
     
  4. Offline

    Iervolino

    Assist
    I made this, but isn't working
    Code:
        @EventHandler
        public void onPlayerJoin(PlayerJoinEvent event){
            Player player = event.getPlayer();
            if(player.getAddress().getAddress().getHostAddress().equals("playiervolino.servegame.com")){
                player.kickPlayer("Connect with the new IP -> test.ip");
            }
        }
     
  5. Iervolino
    getAddress().getAddress().getHostAddress() returns the player's InetAddress, not the address they connected to.
     
  6. Offline

    Iervolino


    Yes, but I want to know the address the player used to connect to the server. Is it possible?
     
  7. Offline

    Technius

    Iervolino
    Oh, we thought you meant the player's IP address.

    This is a more complicated problem. It will be easier to just point your old IP to your new IP.
     
  8. Offline

    krisdestruction

    GrandmaJam likes this.
Thread Status:
Not open for further replies.

Share This Page