Don't throw when removing unplaced player in NearbyPlayers

This commit is contained in:
Nassim Jahnke 2023-09-30 15:37:00 +10:00
parent 0f69290f07
commit c4ba28a21a
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 3 additions and 3 deletions

View File

@ -5469,7 +5469,7 @@ index 0000000000000000000000000000000000000000..808d1449ac44ae86a650932365081fba
+}
diff --git a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
new file mode 100644
index 0000000000000000000000000000000000000000..60c7680d678f9dc6a6a3109b1f6af8150ccd9100
index 0000000000000000000000000000000000000000..a5bd0845a2445fa02561b16fb54a7cf49c114915
--- /dev/null
+++ b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
@@ -0,0 +1,203 @@
@ -5534,7 +5534,7 @@ index 0000000000000000000000000000000000000000..60c7680d678f9dc6a6a3109b1f6af815
+ public void removePlayer(final ServerPlayer player) {
+ final TrackedPlayer[] players = this.players.remove(player);
+ if (players == null) {
+ throw new IllegalStateException("Don't have player " + player);
+ return; // May be called during teleportation before the player is actually placed
+ }
+
+ for (final TrackedPlayer tracker : players) {

View File

@ -9,7 +9,7 @@ class to quickly retrieve nearby players instead of possible
searching all players on the server.
diff --git a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
index 60c7680d678f9dc6a6a3109b1f6af8150ccd9100..d05195358a00e498e0184ab105ebb3dc7a39e15a 100644
index a5bd0845a2445fa02561b16fb54a7cf49c114915..380fd05abe191025e12bdd6811e1df90c96e4667 100644
--- a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
+++ b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
@@ -17,7 +17,8 @@ public final class NearbyPlayers {