mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
71c84c8132
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent 258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD CraftBukkit Changes: 98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent 5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class 76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor Spigot Changes: e9ec5485 Rebuild patches f1b62e0c Rebuild patches
38 lines
2 KiB
Diff
38 lines
2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aeltumn <daniel@goossens.ch>
|
|
Date: Thu, 24 Aug 2023 13:05:07 +0200
|
|
Subject: [PATCH] Add OfflinePlayer#isConnected
|
|
|
|
This adds an alternative to OfflinePlayer#isOnline that returns true only if the same instance of the player is still online. This is generally more useful than isOnline as it allows you to determine if you have an instance of a Player that still exists. If a player relogs an old Player instance becomes unlinked leading to e.g. messages sent to the old player no longer arriving despite isOnline returning true. Checking against isConnected is more useful there to discard invalid instances.
|
|
|
|
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
|
|
index ef6cb124adc98cb5231dc44e243450a2340f74af..abb5109ed08a3a651c2c27d4d17a3d49eb06da1e 100644
|
|
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
|
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
|
@@ -24,10 +24,26 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
|
/**
|
|
* Checks if this player is currently online
|
|
*
|
|
+ * It should be noted that this will return true if any instance of this player is
|
|
+ * online! This instance may have disconnected. If you wish to check if this specific
|
|
+ * instance of the player is still online, see {@link OfflinePlayer#isConnected()}.
|
|
+ *
|
|
* @return true if they are online
|
|
*/
|
|
public boolean isOnline();
|
|
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Checks whether the connection to this player is still valid. This will return
|
|
+ * true as long as this specific instance of the player is still connected. This
|
|
+ * will return false after this instance has disconnected, even if the same player
|
|
+ * has reconnected since.
|
|
+ *
|
|
+ * @return true if this player instance is connected
|
|
+ */
|
|
+ public boolean isConnected();
|
|
+ // Paper end
|
|
+
|
|
/**
|
|
* Returns the name of this player
|
|
* <p>
|