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

43 Zeilen
1.7 KiB
Diff

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
2023-12-05 18:20:55 +01:00
index 9daec0782774ab51ea8091cb8ed9d0a106e34cfa..2bbc39c257965ad91ee360cdfcd3538a0f041c7e 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
@@ -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 b7f5c1ec495a61528d95fd91b9d60428e9b00438..11d56ec04b2f63c8a0fb54e586bebe98afc1a3ad 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
@@ -282,6 +282,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() {
if (this.getHandle().connection == null) return null;