Paper/patches/server/0864-Implement-OfflinePlayer-isConnected.patch

43 lines
1.7 KiB
Diff
Raw Normal View History

2023-08-24 13:44:31 +02:00
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
2023-08-24 13:44:31 +02:00
--- 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
2023-08-24 13:44:31 +02:00
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 47180d44b7e168352b17bc295ffb6d3ea6e0a937..96d8bd55ecfb6aca8a6f65bc2a25e5756eecc4d8 100644
2023-08-24 13:44:31 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2024-10-24 19:29:35 +02:00
@@ -261,6 +261,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2023-10-27 01:34:58 +02:00
return this.server.getPlayer(this.getUniqueId()) != null;
2023-08-24 13:44:31 +02:00
}
+ // Paper start
+ @Override
+ public boolean isConnected() {
+ return !this.getHandle().hasDisconnected();
+ }
+ // Paper end
+
@Override
public InetSocketAddress getAddress() {
2024-04-25 00:36:49 +02:00
if (this.getHandle().connection.protocol() == null) return null;