Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
43 Zeilen
1.7 KiB
Diff
43 Zeilen
1.7 KiB
Diff
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 c6129dc565b8f874b73e2fefcabd4be1c221fd73..c1b874cd6e0498fce3cd53fdbaca30d290e004d7 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 5db28d16070b5d5ec076ec3c7c84e5d7cf230601..ae3ded93ea1440ec2cb9bb7740e9a983210de0fa 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 server.getPlayer(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;
|