summaryrefslogtreecommitdiffhomepage
path: root/patches/server/0872-Implement-OfflinePlayer-isConnected.patch
blob: 199101506f46434453d3e07ffafe66d75647b9a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aeltumn <daniel@goossens.ch>
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 2c2c4db31a746b4eb853dc04c6b3e5631bbfa034..4f4e3ee18d586f61706504218cddc06a38ca5580 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 a3912d4de96a6bb2b9b3977705fa3facb891f73d..a1b870fb3d1fd5d209474c47bf523d0d5d58ce39 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -256,6 +256,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.protocol() == null) return null;