This commit is contained in:
boy0001 2015-05-07 18:15:51 +10:00
parent 9621c4ba90
commit 9b1678d22a
2 changed files with 15 additions and 8 deletions

View File

@ -94,7 +94,11 @@ public class PlotSquared {
public static WorldEditPlugin worldEdit = null; public static WorldEditPlugin worldEdit = null;
private final static HashMap<String, PlotWorld> plotworlds = new HashMap<>(); private final static HashMap<String, PlotWorld> plotworlds = new HashMap<>();
private final static HashMap<String, PlotManager> plotmanagers = new HashMap<>(); private final static HashMap<String, PlotManager> plotmanagers = new HashMap<>();
private static LinkedHashMap<String, HashMap<PlotId, Plot>> plots; private static LinkedHashMap<String, HashMap<PlotId, Plot>> plots;
private static Database database; private static Database database;
public static Connection connection; public static Connection connection;

View File

@ -186,7 +186,7 @@ public class BukkitHybridUtils extends HybridUtils {
this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
if (regions.size() == 0) { if (regions.size() == 0 && chunks.size() == 0) {
BukkitHybridUtils.UPDATE = false; BukkitHybridUtils.UPDATE = false;
PlotSquared.log(C.PREFIX.s() + "Finished road conversion"); PlotSquared.log(C.PREFIX.s() + "Finished road conversion");
Bukkit.getScheduler().cancelTask(BukkitHybridUtils.this.task); Bukkit.getScheduler().cancelTask(BukkitHybridUtils.this.task);
@ -194,12 +194,14 @@ public class BukkitHybridUtils extends HybridUtils {
} else { } else {
try { try {
if (chunks.size() < 1024) { if (chunks.size() < 1024) {
final ChunkLoc loc = regions.get(0); if (regions.size() > 0) {
PlotSquared.log("&3Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 1024 chunks)"); final ChunkLoc loc = regions.get(0);
PlotSquared.log(" - Remaining: " + regions.size()); PlotSquared.log("&3Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 1024 chunks)");
chunks.addAll(getChunks(regions.get(0))); PlotSquared.log(" - Remaining: " + regions.size());
regions.remove(0); chunks.addAll(getChunks(loc));
System.gc(); regions.remove(0);
System.gc();
}
} }
if (chunks.size() > 0) { if (chunks.size() > 0) {
long diff = System.currentTimeMillis() + 25; long diff = System.currentTimeMillis() + 25;
@ -222,7 +224,7 @@ public class BukkitHybridUtils extends HybridUtils {
return; return;
} }
if (System.currentTimeMillis() - last < 50) { if (System.currentTimeMillis() - last < 50) {
while (System.currentTimeMillis() < diff) { while (System.currentTimeMillis() < diff && chunks.size() > 0) {
ChunkLoc chunk = chunks.get(0); ChunkLoc chunk = chunks.get(0);
chunks.remove(0); chunks.remove(0);
regenerateRoad(world, chunk); regenerateRoad(world, chunk);
@ -232,6 +234,7 @@ public class BukkitHybridUtils extends HybridUtils {
last = System.currentTimeMillis(); last = System.currentTimeMillis();
} }
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace();
final ChunkLoc loc = regions.get(0); final ChunkLoc loc = regions.get(0);
PlotSquared.log("&c[ERROR]&7 Could not update '" + world + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)"); 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 sx = loc.x << 5;