From b4f987e4709d5afa9f9fb41baf22b44d46a9b3fa Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 19 Oct 2014 17:37:17 +1100 Subject: [PATCH] fixed concurrentModificationException --- .../src/com/intellectualcrafters/plot/PlotMain.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java index c6cce82e8..4c7c3b6aa 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java @@ -9,6 +9,7 @@ package com.intellectualcrafters.plot; import ca.mera.CameraAPI; + import com.intellectualcrafters.plot.Logger.LogLevel; import com.intellectualcrafters.plot.Settings.Web; import com.intellectualcrafters.plot.commands.Camera; @@ -29,8 +30,10 @@ import com.intellectualcrafters.plot.uuid.PlotUUIDSaver; import com.intellectualcrafters.plot.uuid.UUIDSaver; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; + import me.confuser.barapi.BarAPI; import net.milkbowl.vault.economy.Economy; + import org.bukkit.*; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Entity; @@ -426,6 +429,9 @@ public class PlotMain extends JavaPlugin { public void run() { for (String world : getPlotWorldsString()) { if (plots.containsKey(world)) { + + ArrayList toDeletePlot = new ArrayList(); + for (Plot plot : plots.get(world).values()) { if (plot.owner == null) { continue; @@ -442,10 +448,13 @@ public class PlotMain extends JavaPlugin { event.setCancelled(true); } else { - DBFunc.delete(world, plot); + toDeletePlot.add(plot); } } } + for (Plot plot: toDeletePlot) { + DBFunc.delete(world, plot); + } } } }