From f7f36179d325285919c7d0f4f0434d1909075988 Mon Sep 17 00:00:00 2001 From: tastybento Date: Mon, 26 Oct 2020 17:11:52 -0700 Subject: [PATCH] Switch removeIf check May help with https://github.com/BentoBoxWorld/BentoBox/issues/1550 I cannot understand why an CME is happening with removeIf. It should not be possible. --- .../world/bentobox/bentobox/managers/PlayersManager.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/managers/PlayersManager.java b/src/main/java/world/bentobox/bentobox/managers/PlayersManager.java index ff5719126..4e81c3575 100644 --- a/src/main/java/world/bentobox/bentobox/managers/PlayersManager.java +++ b/src/main/java/world/bentobox/bentobox/managers/PlayersManager.java @@ -487,10 +487,9 @@ public class PlayersManager { */ public void removePlayer(Player player) { // Clear any players with the same name - playerCache.values().removeIf(p -> p.getPlayerName().equalsIgnoreCase(player.getName())); + playerCache.values().removeIf(p -> player.getName().equalsIgnoreCase(p.getPlayerName())); // Remove if the player's UUID is the same - playerCache.values().removeIf(p -> p.getUniqueId().equals(player.getUniqueId().toString())); - + playerCache.values().removeIf(p -> player.getUniqueId().toString().equals(p.getUniqueId())); } }