progress update

This commit is contained in:
BuildTools 2016-11-23 22:08:58 -05:00
parent 841ee979be
commit f978862cfa
3 changed files with 53 additions and 20 deletions

View file

@ -1,22 +1,17 @@
package iieLoadSaveEntireWorld; package iieLoadSaveEntireWorld;
import java.util.HashMap;
import java.util.Map;
import java.util.Set; import java.util.Set;
public class Cache { public class Cache {
private static int maxNameLength; private static int maxNameLength;
private static char[][] worldsUnfinished; private static char[][] listUnfinished;
static class WorldStatus { private static Map<String,WorldStatus> cacheWorldStatus;
} //PRIVATE METHODS===============================
static void updateListUnfinished() private static char[][] populate(Set<String> set)
{
Set<String> unfin = Main.config.getConfigurationSection("unfinished worlds").getKeys(false);
maxNameLength = Main.config.getInt("max name length");
worldsUnfinished = populate(unfin);
}
static char[][] populate(Set<String> set)
{ {
char[][] worlds = new char[set.size()][maxNameLength]; char[][] worlds = new char[set.size()][maxNameLength];
int i = 0; int i = 0;
@ -32,11 +27,27 @@ public class Cache {
ii = 0; ii = 0;
} }
return worlds; return worlds;
}
private static void cache()
{
}
//PUBLIC METHODS================================
static void generate()
{
maxNameLength = Main.config.getInt("max name length");
listUnfinished = populate(Main.unfinished.getKeys(false));
cache();
}
static void saveProgress()
{
} }
static boolean isUnfinished(String name){ static boolean isUnfinished(String name){
int i = 0; int i = 0;
boolean match = true; boolean match = true;
for (char[] world : worldsUnfinished) for (char[] world : listUnfinished)
{ {
for (char c : name.toCharArray()) for (char c : name.toCharArray())
{ {
@ -48,5 +59,21 @@ public class Cache {
} }
return match; return match;
} }
static void addUnfinished(int width, int[] center, int[] lowerleft, String name)
{
}
static final class WorldStatus {
int width;
int[] center;
int[] lowerleft;
int[] currentRegion;
int n;
int D;
int d;
boolean B;
}
} }

View file

@ -29,7 +29,7 @@ public class LoadSaveProcess implements Runnable {
totalRegions = width*width; totalRegions = width*width;
untilSaveProg = 9; untilSaveProg = 9;
} }
public static void resume(String name) static void resume(String name)
{ {
String path = "unfinishedWorlds." + name + "."; String path = "unfinishedWorlds." + name + ".";
@ -57,7 +57,7 @@ public class LoadSaveProcess implements Runnable {
SavePattern.d = Main.config.getInt(path + "d"); SavePattern.d = Main.config.getInt(path + "d");
SavePattern.B = Main.config.getBoolean(path + "B"); SavePattern.B = Main.config.getBoolean(path + "B");
} }
public static void saveProgress() static void saveProgress()
{ {
String path = "unfinishedWorlds." + worldName + "."; String path = "unfinishedWorlds." + worldName + ".";
Main.config.set(path + "currentRegion.x", currentRegion[0]); Main.config.set(path + "currentRegion.x", currentRegion[0]);
@ -68,7 +68,7 @@ public class LoadSaveProcess implements Runnable {
Main.config.set(path + "B", SavePattern.B); Main.config.set(path + "B", SavePattern.B);
Main.plugin.saveConfig(); Main.plugin.saveConfig();
} }
public static void stop() static void stop()
{ {
saveProgress(); saveProgress();
SavePattern.reset(); SavePattern.reset();
@ -78,7 +78,7 @@ public class LoadSaveProcess implements Runnable {
//===============================PATTERN================================ //===============================PATTERN================================
private static class SavePattern { static final class SavePattern {
/* The pattern: /* The pattern:
* *
@ -137,7 +137,7 @@ public class LoadSaveProcess implements Runnable {
//===============================CHUNK MAP============================== //===============================CHUNK MAP==============================
private static class Map private static final class Map
{ {
private static int[] lowerleft; private static int[] lowerleft;
private static int[][][][][] allChunkCoords; private static int[][][][][] allChunkCoords;

View file

@ -1,5 +1,6 @@
package iieLoadSaveEntireWorld; package iieLoadSaveEntireWorld;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
@ -8,21 +9,26 @@ public class Main extends JavaPlugin {
static Main plugin; static Main plugin;
static FileConfiguration config; static FileConfiguration config;
static ConfigurationSection unfinished;
static StartCommand start; static StartCommand start;
static StopCommand stop; static StopCommand stop;
static LoadSaveProcess process;
static BukkitTask task; static BukkitTask task;
public void onEnable() public void onEnable()
{ {
plugin = this; plugin = this;
config = plugin.getConfig(); config = plugin.getConfig();
unfinished = config.getConfigurationSection("unfinished worlds");
start = new StartCommand(plugin); start = new StartCommand(plugin);
stop = new StopCommand(plugin); stop = new StopCommand(plugin);
process = new LoadSaveProcess();
saveDefaultConfig(); saveDefaultConfig();
getCommand("beginloadsave").setExecutor(start); getCommand("beginloadsave").setExecutor(start);
getCommand("stoploadsave").setExecutor(stop); getCommand("stoploadsave").setExecutor(stop);
Cache.updateListUnfinished(); Cache.generate();
} }
} }