mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-06 02:42:14 +01:00
43 lines
1.7 KiB
Diff
43 lines
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 4d654c4f0b6210a9841427789ba70ce5d1d308be..9d93130f23addb18b97d7f5ec013faef17a74529 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 5f5632e7d6d02fbe9f7024b8316414d8aa302d60..8f92ff51647a1919d90219d0cab1710aa9ff7361 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -254,6 +254,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;
|