diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml index 2ceca78fd..1234a06fc 100644 --- a/PlotSquared/pom.xml +++ b/PlotSquared/pom.xml @@ -8,7 +8,7 @@ UTF-8 PlotSquared - 2.8.1 + 2.8.3 PlotSquared jar diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java index 81e73bf20..7ac04b8b8 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java @@ -20,6 +20,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import com.intellectualcrafters.plot.commands.SubCommand.CommandCategory; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.CmdInstance; import com.intellectualcrafters.plot.object.PlotPlayer; @@ -32,7 +33,7 @@ import com.intellectualcrafters.plot.util.TaskManager; */ public class Confirm extends SubCommand { public Confirm() { - super(Command.CONFIRM, "Confirm command execution", "confirm", CommandCategory.ACTIONS, true); + super("confirm", "plots.use", "Confirm an action", "confirm", "confirm", CommandCategory.ACTIONS, false); } @Override diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java index 08601cd05..7b0f4090a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java @@ -85,6 +85,7 @@ public class BukkitHybridUtils extends HybridUtils { final Chunk chunk = world.getChunkAt(x, z); chunks2.add(chunk); regenerateRoad(worldname, new ChunkLoc(x, z)); + ChunkManager.manager.unloadChunk(worldname, new ChunkLoc(x, z)); } } BukkitSetBlockManager.setBlockManager.update(chunks2); @@ -92,6 +93,8 @@ public class BukkitHybridUtils extends HybridUtils { private static boolean UPDATE = false; private int task; + private long LAST = 0; + private double AV = 1000; @Override public boolean scheduleRoadUpdate(final String world) { @@ -109,18 +112,35 @@ public class BukkitHybridUtils extends HybridUtils { Bukkit.getScheduler().cancelTask(BukkitHybridUtils.this.task); return; } else { - try { - final ChunkLoc loc = chunks.get(0); - PlotSquared.log("Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 256 chunks)"); - PlotSquared.log("Remaining regions: " + chunks.size()); - regenerateChunkChunk(world, loc); - chunks.remove(0); - } catch (final Exception e) { - final ChunkLoc loc = chunks.get(0); - PlotSquared.log("&c[ERROR]&7 Could not update '" + world + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)"); - PlotSquared.log("&d - Potentially skipping 256 chunks"); - PlotSquared.log("&d - TODO: recommend chunkster if corrupt"); + if (LAST == 0) { + LAST = System.currentTimeMillis(); } + AV = (System.currentTimeMillis() - LAST + AV) / 2; + if (AV < 1050) { + try { + final ChunkLoc loc = chunks.get(0); + PlotSquared.log("Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 256 chunks)"); + PlotSquared.log("Remaining regions: " + chunks.size()); + regenerateChunkChunk(world, loc); + chunks.remove(0); + } catch (final Exception e) { + final ChunkLoc loc = chunks.get(0); + PlotSquared.log("&c[ERROR]&7 Could not update '" + world + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)"); + final int sx = loc.x << 5; + final int sz = loc.z << 5; + for (int x = sx; x < (sx + 32); x++) { + for (int z = sz; z < (sz + 32); z++) { + ChunkManager.manager.unloadChunk(world, new ChunkLoc(x, z)); + } + } + PlotSquared.log("&d - Potentially skipping 256 chunks"); + PlotSquared.log("&d - TODO: recommend chunkster if corrupt"); + } + } + else { + System.out.print("TPS LOW: " + (System.currentTimeMillis() - LAST) + " | " + AV); + } + LAST = System.currentTimeMillis(); } } }, 20, 20); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java index de74ba811..be33557cb 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java @@ -164,7 +164,6 @@ public abstract class HybridUtils { } } } - ChunkManager.manager.unloadChunk(world, chunk); return true; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java index 6d3fe9a2f..bb330e878 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java @@ -169,8 +169,6 @@ public class BukkitChunkManager extends ChunkManager { final int c2z = c2.getZ(); final int c3x = c3.getX(); final int c3z = c3.getZ(); - final int c4x = c4.getX(); - final int c4z = c4.getZ(); final ArrayList chunks = new ArrayList<>(); final ArrayList toGenerate = new ArrayList<>(); // Load chunks @@ -254,7 +252,7 @@ public class BukkitChunkManager extends ChunkManager { tasks.put(currentIndex, loadTask); return true; } - + @Override public boolean regenerateRegion(final Location pos1, final Location pos2, final Runnable whenDone) { index.increment();