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 96408d505ce80799868ff84554a3b0b25adabb22..4a875bce9563f3b9351ebecde9b0eb1287beb50e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -54,6 +54,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 2c7c39eab2bdbedf4aea903ba76f3289285bd7e7..3cbebe9a08a6f37c8716a71db9c34454025b458a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -243,6 +243,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;