Disconnection help

Discussion in 'Spigot Plugin Development' started by UnlimitedNinjas, Jul 29, 2018.

  1. So when a player tries to login but he can't and it displays the message: "Your username is already logged into this server.", how can i detect this and run some code?
     
  2. PlayerLoginEvent#getResult() will return a Result based on what happens. Judging by the lack of an result for being kicked for already being logged in, I'd guess that it will return KICK_OTHER.

    You may also be able to check the getKickMessage() to see if it matches the message you're wanting to check for.

    I doubt you can prevent the player from being kicked in the event that they receive that particular message though, if that's something you'll need to do.