diff options
author | Shane Freeder <[email protected]> | 2023-11-05 22:15:38 +0000 |
---|---|---|
committer | Shane Freeder <[email protected]> | 2023-11-05 22:15:38 +0000 |
commit | 4675152f4908431e0f944a7bf9fa3b2181a2dfd6 (patch) | |
tree | ea19ec0740d27e6d4d2abaa1b1855fe9213aa03e | |
parent | 274e54ba58383e352ee631ed2934858e77c887ea (diff) | |
download | Paper-4675152f4908431e0f944a7bf9fa3b2181a2dfd6.tar.gz Paper-4675152f4908431e0f944a7bf9fa3b2181a2dfd6.zip |
Don't leave the NearbyPlayers tracker in an entirely busted state on double-add detection
-rw-r--r-- | patches/server/0009-MC-Utils.patch | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index 0850a593eb..cedc57e0e8 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -5473,7 +5473,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..a5bd0845a2445fa02561b16fb54a7cf49c114915 +index 0000000000000000000000000000000000000000..c3ce8a42dddd76b7189ad5685b23f9d9f8ccadb3 --- /dev/null +++ b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java @@ -0,0 +1,203 @@ @@ -5520,7 +5520,7 @@ index 0000000000000000000000000000000000000000..a5bd0845a2445fa02561b16fb54a7cf4 + + public void addPlayer(final ServerPlayer player) { + final TrackedPlayer[] newTrackers = new TrackedPlayer[TOTAL_MAP_TYPES]; -+ if (this.players.put(player, newTrackers) != null) { ++ if (this.players.putIfAbsent(player, newTrackers) != null) { + throw new IllegalStateException("Already have player " + player); + } + |