Found a fix, maybe for the saving issues. Checked out some other forks of worldborder, and noticed that this seemed to help @Brokkonaut -> Author who fixed the issue.

This commit is contained in:
PryPurity 2020-07-15 16:26:53 -05:00
parent 30958adec0
commit 51c8438143
5 changed files with 24 additions and 20 deletions

View File

@ -420,9 +420,9 @@ public class Config {
logConfig("Border-checking timed task stopped.");
}
public static void StopFillTask() {
public static void StopFillTask(boolean Save) {
if (fillTask != null && fillTask.valid())
fillTask.cancel();
fillTask.cancel(Save);
}
public static void StoreFillTask() {
@ -589,16 +589,15 @@ public class Config {
ConfigurationSection storedFillTask = cfg.getConfigurationSection("fillTask");
if (storedFillTask != null) {
String worldName = storedFillTask.getString("world");
int fillDistance = storedFillTask.getInt("fillDistance", 176);
int chunksPerRun = storedFillTask.getInt("chunksPerRun", 5);
int tickFrequency = storedFillTask.getInt("tickFrequency", 20);
int fillDistance = storedFillTask.getInt("fillDistance", 208);
int chunksPerRun = storedFillTask.getInt("chunksPerRun", 2);
int tickFrequency = storedFillTask.getInt("tickFrequency", 5);
int fillX = storedFillTask.getInt("x", 0);
int fillZ = storedFillTask.getInt("z", 0);
int fillLength = storedFillTask.getInt("length", 0);
int fillTotal = storedFillTask.getInt("total", 0);
boolean forceLoad = storedFillTask.getBoolean("forceLoad", false);
RestoreFillTask(worldName, fillDistance, chunksPerRun, tickFrequency, fillX, fillZ, fillLength, fillTotal, forceLoad);
save(false);
}
if (logIt)

View File

@ -45,7 +45,7 @@ public class WorldBorder extends JavaPlugin {
DynMapFeatures.removeAllBorders();
Config.StopBorderTimer();
Config.StoreFillTask();
Config.StopFillTask();
Config.StopFillTask(true);
}
// for other plugins to hook into

View File

@ -78,21 +78,21 @@ public class WorldFillTask implements Runnable {
sendMessage("You must specify a world!");
else
sendMessage("World \"" + worldName + "\" not found!");
this.stop();
this.stop(true);
return;
}
this.border = (Config.Border(worldName) == null) ? null : Config.Border(worldName).copy();
if (this.border == null) {
sendMessage("No border found for world \"" + worldName + "\"!");
this.stop();
this.stop(false);
return;
}
// load up a new WorldFileData for the world in question, used to scan region files for which chunks are already fully generated and such
worldData = WorldFileData.create(world, notifyPlayer);
if (worldData == null) {
this.stop();
this.stop(false);
return;
}
@ -123,7 +123,7 @@ public class WorldFillTask implements Runnable {
}
public void setTaskID(int ID) {
if (ID == -1) this.stop();
if (ID == -1) this.stop(false);
this.taskID = ID;
}
@ -226,7 +226,7 @@ public class WorldFillTask implements Runnable {
// if this iteration has been running for 45ms (almost 1 tick) or more, stop to take a breather
if (now > loopStartTime + 45) {
System.out.println("PAUSED FOR DEBUG");
//System.out.println("PAUSED FOR DEBUG");
readyToGo = true;
return;
}
@ -350,16 +350,17 @@ public class WorldFillTask implements Runnable {
world.save();
Bukkit.getServer().getPluginManager().callEvent(new WorldBorderFillFinishedEvent(world, reportTotal));
sendMessage("task successfully completed for world \"" + refWorld() + "\"!");
this.stop();
this.stop(false);
}
// for cancelling prematurely
public void cancel() {
this.stop();
public void cancel(boolean Save) {
this.stop(Save);
}
// we're done, whether finished or cancelled
private void stop() {
private void stop(boolean Save) {
if (!Save) Config.UnStoreFillTask();
if (server == null)
return;
@ -403,8 +404,7 @@ public class WorldFillTask implements Runnable {
if (this.paused) {
Config.StoreFillTask();
reportProgress();
} else
Config.UnStoreFillTask();
}
}
public boolean isPaused() {
@ -439,6 +439,7 @@ public class WorldFillTask implements Runnable {
lastAutosave = lastReport;
sendMessage("Saving the world to disk, just to be on the safe side.");
world.save();
Config.StoreFillTask();
}
}
@ -471,6 +472,10 @@ public class WorldFillTask implements Runnable {
this.length = length;
this.reportTotal = totalDone;
this.continueNotice = true;
this.refX = x;
this.refZ = z;
this.refLength = length;
this.refTotal = totalDone;
}
public int refX() {

View File

@ -48,7 +48,7 @@ public class CmdFill extends WBCmd {
return;
sender.sendMessage(C_HEAD + "Cancelling the world map generation task.");
fillDefaults();
Config.StopFillTask();
Config.StopFillTask(true);
return;
} else if (check.equals("pause")) {
if (!makeSureFillIsRunning(sender))

View File

@ -2,7 +2,7 @@ name: WorldBorder
authors: [Brettflan, PryPurity]
description: Efficient, feature-rich plugin for limiting the size of your worlds.
version: 2.0.8
api-version: 1.16
api-version: 1.15
main: com.wimbli.WorldBorder.WorldBorder
softdepend:
- dynmap