Skip to content

Commit

Permalink
Don't leave the NearbyPlayers tracker in an entirely busted state on …
Browse files Browse the repository at this point in the history
…double-add detection
  • Loading branch information
electronicboy committed Nov 5, 2023
1 parent 274e54b commit 4675152
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions patches/server/0009-MC-Utils.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand Down Expand Up @@ -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);
+ }
+
Expand Down

0 comments on commit 4675152

Please sign in to comment.