mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 17:01:56 +01:00
Don't leave the NearbyPlayers tracker in an entirely busted state on double-add detection
This commit is contained in:
parent
6951909f8d
commit
3cf895a891
1 changed files with 1 additions and 1 deletions
|
@ -5520,7 +5520,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ public void addPlayer(final ServerPlayer player) {
|
+ public void addPlayer(final ServerPlayer player) {
|
||||||
+ final TrackedPlayer[] newTrackers = new TrackedPlayer[TOTAL_MAP_TYPES];
|
+ 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);
|
+ throw new IllegalStateException("Already have player " + player);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
|
Loading…
Reference in a new issue