From 1fc4ca9178206b6c75a2627ecdf0dba2e8677a98 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

---
 .../java/org/bukkit/craftbukkit/CraftOfflinePlayer.java    | 7 +++++++
 .../java/org/bukkit/craftbukkit/entity/CraftPlayer.java    | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
index 2c2c4db31a..4f4e3ee18d 100644
--- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
+++ b/paper-server/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/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 006d44e0a1..f49944a4e6 100644
--- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -261,6 +261,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;