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 de5d0b29d9b4631e7197520de7eb99ac6d9c8165..3d061f6dd550e395ec572ecdbd80b8d2d36a4453 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -237,6 +237,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;