aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/1009-Implement-OfflinePlayer-isConnected.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/1009-Implement-OfflinePlayer-isConnected.patch')
-rw-r--r--patches/server/1009-Implement-OfflinePlayer-isConnected.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/patches/server/1009-Implement-OfflinePlayer-isConnected.patch b/patches/server/1009-Implement-OfflinePlayer-isConnected.patch
new file mode 100644
index 0000000000..2cf0e8deb5
--- /dev/null
+++ b/patches/server/1009-Implement-OfflinePlayer-isConnected.patch
@@ -0,0 +1,42 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aeltumn <[email protected]>
+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 f9b2d773449fa5d332e0c37454ba6ea731982e85..bb794638a990488afc8d9d245dd203269c2b38b2 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 dfa1f48b6d61c6644a02adbd5a5183f917a2982c..57229748ae446d70dbc3d71219d9f81f5c8f72b1 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;