This commit is contained in:
boy0001 2015-03-10 20:01:06 +11:00
parent f83003e080
commit 61ebd2a144
5 changed files with 35 additions and 17 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>2.8.1</version> <version>2.8.3</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -20,6 +20,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.commands.SubCommand.CommandCategory;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.CmdInstance; import com.intellectualcrafters.plot.object.CmdInstance;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
@ -32,7 +33,7 @@ import com.intellectualcrafters.plot.util.TaskManager;
*/ */
public class Confirm extends SubCommand { public class Confirm extends SubCommand {
public Confirm() { 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 @Override

View File

@ -85,6 +85,7 @@ public class BukkitHybridUtils extends HybridUtils {
final Chunk chunk = world.getChunkAt(x, z); final Chunk chunk = world.getChunkAt(x, z);
chunks2.add(chunk); chunks2.add(chunk);
regenerateRoad(worldname, new ChunkLoc(x, z)); regenerateRoad(worldname, new ChunkLoc(x, z));
ChunkManager.manager.unloadChunk(worldname, new ChunkLoc(x, z));
} }
} }
BukkitSetBlockManager.setBlockManager.update(chunks2); BukkitSetBlockManager.setBlockManager.update(chunks2);
@ -92,6 +93,8 @@ public class BukkitHybridUtils extends HybridUtils {
private static boolean UPDATE = false; private static boolean UPDATE = false;
private int task; private int task;
private long LAST = 0;
private double AV = 1000;
@Override @Override
public boolean scheduleRoadUpdate(final String world) { public boolean scheduleRoadUpdate(final String world) {
@ -109,18 +112,35 @@ public class BukkitHybridUtils extends HybridUtils {
Bukkit.getScheduler().cancelTask(BukkitHybridUtils.this.task); Bukkit.getScheduler().cancelTask(BukkitHybridUtils.this.task);
return; return;
} else { } else {
try { if (LAST == 0) {
final ChunkLoc loc = chunks.get(0); LAST = System.currentTimeMillis();
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");
} }
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); }, 20, 20);

View File

@ -164,7 +164,6 @@ public abstract class HybridUtils {
} }
} }
} }
ChunkManager.manager.unloadChunk(world, chunk);
return true; return true;
} }
} }

View File

@ -169,8 +169,6 @@ public class BukkitChunkManager extends ChunkManager {
final int c2z = c2.getZ(); final int c2z = c2.getZ();
final int c3x = c3.getX(); final int c3x = c3.getX();
final int c3z = c3.getZ(); final int c3z = c3.getZ();
final int c4x = c4.getX();
final int c4z = c4.getZ();
final ArrayList<Chunk> chunks = new ArrayList<>(); final ArrayList<Chunk> chunks = new ArrayList<>();
final ArrayList<Chunk> toGenerate = new ArrayList<>(); final ArrayList<Chunk> toGenerate = new ArrayList<>();
// Load chunks // Load chunks
@ -254,7 +252,7 @@ public class BukkitChunkManager extends ChunkManager {
tasks.put(currentIndex, loadTask); tasks.put(currentIndex, loadTask);
return true; return true;
} }
@Override @Override
public boolean regenerateRegion(final Location pos1, final Location pos2, final Runnable whenDone) { public boolean regenerateRegion(final Location pos1, final Location pos2, final Runnable whenDone) {
index.increment(); index.increment();