Fixed progress loading/saving and added msg

This commit is contained in:
Norbi Peti 2016-11-26 17:34:16 +01:00
parent d25c038ec9
commit fcae070f7f
2 changed files with 15 additions and 5 deletions

View file

@ -1,5 +1,6 @@
package iieLoadSaveEntireWorld;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
public class ConfigProcess implements Runnable {
@ -22,13 +23,13 @@ public class ConfigProcess implements Runnable {
config.getInt(name + ".width"),
new int[]
{
config.getInt(name + ".currentRegion.x"),
config.getInt(name + ".currentRegion.z")
config.getInt(name + ".lowerleft.x"),
config.getInt(name + ".lowerleft.z")
},
new int[]
{
config.getInt(name + ".lowerleft.x"),
config.getInt(name + ".lowerleft.z")
config.getInt(name + ".currentRegion.x"),
config.getInt(name + ".currentRegion.z")
},
config.getInt(name + ".n"),
config.getInt(name + ".c"),
@ -45,6 +46,12 @@ public class ConfigProcess implements Runnable {
{
if(config == null)
config = Main.getPlugin().getConfig();
Bukkit.getLogger().info("Loading in progress: " + name
+ "[" + TaskManager.loadProcess.currentRegion[0] + ","
+ TaskManager.loadProcess.currentRegion[1] + "]");
config.set(name + ".width", TaskManager.loadProcess.width);
config.set(name + ".lowerleft.x", TaskManager.loadProcess.lowerleft[0]);
config.set(name + ".lowerleft.z", TaskManager.loadProcess.lowerleft[1]);
config.set(name + ".currentRegion.x", TaskManager.loadProcess.currentRegion[0]);
config.set(name + ".currentRegion.z", TaskManager.loadProcess.currentRegion[1]);
config.set(name + ".n", TaskManager.loadProcess.n);

View file

@ -11,6 +11,7 @@ public class LoadProcess implements Runnable
final String worldname;
final int totalRegions;
int[] currentRegion;
int width;
LoadProcess(String name, WorldObject newWorld)
@ -22,6 +23,7 @@ public class LoadProcess implements Runnable
currentRegion = newWorld.current;
this.lowerleft = newWorld.lowerleft;
width = newWorld.width;
allChunkCoords = generateAllChunkCoords(newWorld.width, newWorld.lowerleft);
}
LoadProcess(String name)
@ -35,6 +37,7 @@ public class LoadProcess implements Runnable
currentRegion = unfinished.current;
this.lowerleft = unfinished.lowerleft;
width = unfinished.width;
allChunkCoords = generateAllChunkCoords(unfinished.width, unfinished.lowerleft);
this.n = unfinished.n;
@ -97,7 +100,7 @@ public class LoadProcess implements Runnable
//===============================CHUNK MAP==============================
private final int[] lowerleft;
final int[] lowerleft;
private final int[][][][][] allChunkCoords;
private final int[][][][][] generateAllChunkCoords(int w,int[] lowerleft)
{