Getting the domain a player used to log in

Discussion in 'BungeeCord Plugin Development' started by Kunhunjon, May 27, 2015.

  1. I'm using SRV records and forced hosts to connect players to my server. I wanted to make a plugin that would get the SRV domain (i.e. bungee.test.example) a player used to log in and correspond that to a location where the user will spawn in my Hub server. Is there an event I can use that will grab what domain the Player used to log in?

    Thanks in advance,
    Kunhunjon
     
  2. That gets the hostname the player used to login with... Is that what you were after?

    Code (Text):

    public void onLogin(PlayerLoginEvent e)
        {
            e.getHostname();
        }
     
    EDIT: Sorry I just realised this would not work if you are using bungeecord, as this would return the same address every time (the bungeecord address) I believe you can do this on bungee using the follwoing...

    Code (Text):

    public void onProxyLogin(LoginEvent e)
        {
            e.getConnection().getAddress().getHostName();
        }
     
     
    #2 Thrusmyster, May 27, 2015
    Last edited: May 27, 2015
    • Winner Winner x 1
  3. Awesome! Thats what I saw when I looked through the JavaDocs. I'll try it out and reply if it doesn't work.