From c4ba28a21a923a99c8ef9a9e42b66862c04743f5 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sat, 30 Sep 2023 15:37:00 +1000 Subject: [PATCH] Don't throw when removing unplaced player in NearbyPlayers --- patches/server/0009-MC-Utils.patch | 4 ++-- patches/server/1027-Optimise-chunk-tick-iteration.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index a5c13820bd..9086079a04 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -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) { diff --git a/patches/server/1027-Optimise-chunk-tick-iteration.patch b/patches/server/1027-Optimise-chunk-tick-iteration.patch index c172557be5..d5d2c0ec75 100644 --- a/patches/server/1027-Optimise-chunk-tick-iteration.patch +++ b/patches/server/1027-Optimise-chunk-tick-iteration.patch @@ -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 {