From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aeltumn Date: Thu, 24 Aug 2023 13:05:30 +0200 Subject: [PATCH] Implement OfflinePlayer#isConnected diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java index 9daec0782774ab51ea8091cb8ed9d0a106e34cfa..2bbc39c257965ad91ee360cdfcd3538a0f041c7e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -53,6 +53,13 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa return this.getPlayer() != null; } + // Paper start + @Override + public boolean isConnected() { + return false; + } + // Paper end + @Override public String getName() { Player player = this.getPlayer(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 3b6b89954d30908ff5ed23acfacbb3ef9b8a6f03..e593e0bc9d207325a9e9d38296b29230a353077e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -274,6 +274,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this.server.getPlayer(this.getUniqueId()) != null; } + // Paper start + @Override + public boolean isConnected() { + return !this.getHandle().hasDisconnected(); + } + // Paper end + @Override public InetSocketAddress getAddress() { if (this.getHandle().connection == null) return null;