I'd say that a player is no longer 'online' after disconnecting.
So my intuition tells me that PlayerQuitEvent.getPlayer().isOnline() should return false after a player loses connection.
import org.bukkit.Bukkit; import org.bukkit.event.*; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; public class DisconnectedOnlineBugPlugin extends JavaPlugin implements Listener { @Override public void onEnable() { Bukkit.getPluginManager().registerEvents(this, this); } @EventHandler public void onLeave(PlayerQuitEvent event) { this.getLogger().info("event.getPlayer().isOnline() = " + event.getPlayer().isOnline()); } }
DisconnectedOnlineBug.jar
But infact when a player leaves the console output is:
Selebrator lost connection: Disconnected [DisconnectedOnlineBug] event.getPlayer().isOnline() = true Selebrator left the game
I'm open to changing my mind on this. Anyhow I just wanted to raise awareness for this issue.
- duplicates
-
SPIGOT-3090 OfflinePlayer.isOnline() returning true after PlayerQuitEvent
- Resolved