fixed concurrentModificationException

This commit is contained in:
boy0001 2014-10-19 17:37:17 +11:00
parent 7ce30ee955
commit b4f987e470

View File

@ -9,6 +9,7 @@
package com.intellectualcrafters.plot; package com.intellectualcrafters.plot;
import ca.mera.CameraAPI; import ca.mera.CameraAPI;
import com.intellectualcrafters.plot.Logger.LogLevel; import com.intellectualcrafters.plot.Logger.LogLevel;
import com.intellectualcrafters.plot.Settings.Web; import com.intellectualcrafters.plot.Settings.Web;
import com.intellectualcrafters.plot.commands.Camera; import com.intellectualcrafters.plot.commands.Camera;
@ -29,8 +30,10 @@ import com.intellectualcrafters.plot.uuid.PlotUUIDSaver;
import com.intellectualcrafters.plot.uuid.UUIDSaver; import com.intellectualcrafters.plot.uuid.UUIDSaver;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import me.confuser.barapi.BarAPI; import me.confuser.barapi.BarAPI;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -426,6 +429,9 @@ public class PlotMain extends JavaPlugin {
public void run() { public void run() {
for (String world : getPlotWorldsString()) { for (String world : getPlotWorldsString()) {
if (plots.containsKey(world)) { if (plots.containsKey(world)) {
ArrayList<Plot> toDeletePlot = new ArrayList<Plot>();
for (Plot plot : plots.get(world).values()) { for (Plot plot : plots.get(world).values()) {
if (plot.owner == null) { if (plot.owner == null) {
continue; continue;
@ -442,13 +448,16 @@ public class PlotMain extends JavaPlugin {
event.setCancelled(true); event.setCancelled(true);
} }
else { else {
toDeletePlot.add(plot);
}
}
}
for (Plot plot: toDeletePlot) {
DBFunc.delete(world, plot); DBFunc.delete(world, plot);
} }
} }
} }
} }
}
}
}); });
} }
else { else {