From 4b9d472f10e2edc9ac26c0416948437cbfcb32e2 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 12 Feb 2014 11:16:05 +0100 Subject: [PATCH] Fix ConcurrentModificationException with alchemyBrewTask.finishImmediately() Fixes #1848 --- .../java/com/gmail/nossr50/skills/alchemy/Alchemy.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/skills/alchemy/Alchemy.java b/src/main/java/com/gmail/nossr50/skills/alchemy/Alchemy.java index 57059b8c6..1873dae70 100644 --- a/src/main/java/com/gmail/nossr50/skills/alchemy/Alchemy.java +++ b/src/main/java/com/gmail/nossr50/skills/alchemy/Alchemy.java @@ -1,6 +1,8 @@ package com.gmail.nossr50.skills.alchemy; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.bukkit.block.BlockState; @@ -61,7 +63,13 @@ public final class Alchemy { public static void finishAllBrews() { mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews."); + List toFinish = new ArrayList(); + for (AlchemyBrewTask alchemyBrewTask : brewingStandMap.values()) { + toFinish.add(alchemyBrewTask); + } + + for (AlchemyBrewTask alchemyBrewTask : toFinish) { alchemyBrewTask.finishImmediately(); } }