From 32ac57e2a405bddb350cdc40e9ff0d112cc6971d Mon Sep 17 00:00:00 2001 From: Preva1l <149850944+ProdPreva1l@users.noreply.github.com> Date: Mon, 22 Jul 2024 00:14:48 +1000 Subject: [PATCH] fix: cme on potion effect syncing (#354) * Started impl for mongo * fix silly mistake with postgresql * fix: race condition --- .../src/main/java/net/william278/husksync/data/FabricData.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fabric/src/main/java/net/william278/husksync/data/FabricData.java b/fabric/src/main/java/net/william278/husksync/data/FabricData.java index 44a82a3e..5a126f3c 100644 --- a/fabric/src/main/java/net/william278/husksync/data/FabricData.java +++ b/fabric/src/main/java/net/william278/husksync/data/FabricData.java @@ -269,7 +269,8 @@ public abstract class FabricData implements Data { @Override public void apply(@NotNull FabricUser user, @NotNull FabricHuskSync plugin) throws IllegalStateException { final ServerPlayerEntity player = user.getPlayer(); - player.getActiveStatusEffects().forEach((effect, instance) -> player.removeStatusEffect(effect)); + List effectsToRemove = new ArrayList<>(player.getActiveStatusEffects().keySet()); + effectsToRemove.forEach(player::removeStatusEffect); getEffects().forEach(player::addStatusEffect); }