mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fixes #300
This commit is contained in:
parent
9621c4ba90
commit
9b1678d22a
@ -94,7 +94,11 @@ public class PlotSquared {
|
||||
public static WorldEditPlugin worldEdit = null;
|
||||
private final static HashMap<String, PlotWorld> plotworlds = new HashMap<>();
|
||||
private final static HashMap<String, PlotManager> plotmanagers = new HashMap<>();
|
||||
|
||||
|
||||
private static LinkedHashMap<String, HashMap<PlotId, Plot>> plots;
|
||||
|
||||
|
||||
private static Database database;
|
||||
public static Connection connection;
|
||||
|
||||
|
@ -186,7 +186,7 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (regions.size() == 0) {
|
||||
if (regions.size() == 0 && chunks.size() == 0) {
|
||||
BukkitHybridUtils.UPDATE = false;
|
||||
PlotSquared.log(C.PREFIX.s() + "Finished road conversion");
|
||||
Bukkit.getScheduler().cancelTask(BukkitHybridUtils.this.task);
|
||||
@ -194,13 +194,15 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
} else {
|
||||
try {
|
||||
if (chunks.size() < 1024) {
|
||||
if (regions.size() > 0) {
|
||||
final ChunkLoc loc = regions.get(0);
|
||||
PlotSquared.log("&3Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 1024 chunks)");
|
||||
PlotSquared.log(" - Remaining: " + regions.size());
|
||||
chunks.addAll(getChunks(regions.get(0)));
|
||||
chunks.addAll(getChunks(loc));
|
||||
regions.remove(0);
|
||||
System.gc();
|
||||
}
|
||||
}
|
||||
if (chunks.size() > 0) {
|
||||
long diff = System.currentTimeMillis() + 25;
|
||||
if (System.currentTimeMillis() - last > 1000 && last != 0) {
|
||||
@ -222,7 +224,7 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
return;
|
||||
}
|
||||
if (System.currentTimeMillis() - last < 50) {
|
||||
while (System.currentTimeMillis() < diff) {
|
||||
while (System.currentTimeMillis() < diff && chunks.size() > 0) {
|
||||
ChunkLoc chunk = chunks.get(0);
|
||||
chunks.remove(0);
|
||||
regenerateRoad(world, chunk);
|
||||
@ -232,6 +234,7 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
last = System.currentTimeMillis();
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
final ChunkLoc loc = regions.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;
|
||||
|
Loading…
Reference in New Issue
Block a user