Fix ConcurrentModificationException with alchemyBrewTask.finishImmediately()

Fixes #1848
This commit is contained in:
TfT_02 2014-02-12 11:16:05 +01:00
parent 988006f913
commit 4b9d472f10

View File

@ -1,6 +1,8 @@
package com.gmail.nossr50.skills.alchemy; package com.gmail.nossr50.skills.alchemy;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
@ -61,7 +63,13 @@ public final class Alchemy {
public static void finishAllBrews() { public static void finishAllBrews() {
mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews."); mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
List<AlchemyBrewTask> toFinish = new ArrayList<AlchemyBrewTask>();
for (AlchemyBrewTask alchemyBrewTask : brewingStandMap.values()) { for (AlchemyBrewTask alchemyBrewTask : brewingStandMap.values()) {
toFinish.add(alchemyBrewTask);
}
for (AlchemyBrewTask alchemyBrewTask : toFinish) {
alchemyBrewTask.finishImmediately(); alchemyBrewTask.finishImmediately();
} }
} }