From f978862cfae47f2097f99546a10c389a2cbe14ea Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 23 Nov 2016 22:08:58 -0500 Subject: [PATCH] progress update --- src/iieLoadSaveEntireWorld/Cache.java | 53 ++++++++++++++----- .../LoadSaveProcess.java | 12 ++--- src/iieLoadSaveEntireWorld/Main.java | 8 ++- 3 files changed, 53 insertions(+), 20 deletions(-) diff --git a/src/iieLoadSaveEntireWorld/Cache.java b/src/iieLoadSaveEntireWorld/Cache.java index ecf55d0..4c9e675 100644 --- a/src/iieLoadSaveEntireWorld/Cache.java +++ b/src/iieLoadSaveEntireWorld/Cache.java @@ -1,22 +1,17 @@ package iieLoadSaveEntireWorld; +import java.util.HashMap; +import java.util.Map; import java.util.Set; public class Cache { private static int maxNameLength; - private static char[][] worldsUnfinished; - static class WorldStatus { - - } - static void updateListUnfinished() - { - Set unfin = Main.config.getConfigurationSection("unfinished worlds").getKeys(false); - - maxNameLength = Main.config.getInt("max name length"); - worldsUnfinished = populate(unfin); - } - static char[][] populate(Set set) + private static char[][] listUnfinished; + private static Map cacheWorldStatus; + + //PRIVATE METHODS=============================== + private static char[][] populate(Set set) { char[][] worlds = new char[set.size()][maxNameLength]; int i = 0; @@ -32,11 +27,27 @@ public class Cache { ii = 0; } 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){ int i = 0; boolean match = true; - for (char[] world : worldsUnfinished) + for (char[] world : listUnfinished) { for (char c : name.toCharArray()) { @@ -48,5 +59,21 @@ public class Cache { } 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; + } } diff --git a/src/iieLoadSaveEntireWorld/LoadSaveProcess.java b/src/iieLoadSaveEntireWorld/LoadSaveProcess.java index e01649e..c93588e 100644 --- a/src/iieLoadSaveEntireWorld/LoadSaveProcess.java +++ b/src/iieLoadSaveEntireWorld/LoadSaveProcess.java @@ -7,7 +7,7 @@ public class LoadSaveProcess implements Runnable { //=============================STATIC FIELDS============================ - + static boolean inProgress = false; static boolean taskRunning = false; @@ -29,7 +29,7 @@ public class LoadSaveProcess implements Runnable { totalRegions = width*width; untilSaveProg = 9; } - public static void resume(String name) + static void resume(String name) { String path = "unfinishedWorlds." + name + "."; @@ -57,7 +57,7 @@ public class LoadSaveProcess implements Runnable { SavePattern.d = Main.config.getInt(path + "d"); SavePattern.B = Main.config.getBoolean(path + "B"); } - public static void saveProgress() + static void saveProgress() { String path = "unfinishedWorlds." + worldName + "."; 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.plugin.saveConfig(); } - public static void stop() + static void stop() { saveProgress(); SavePattern.reset(); @@ -78,7 +78,7 @@ public class LoadSaveProcess implements Runnable { //===============================PATTERN================================ - private static class SavePattern { + static final class SavePattern { /* The pattern: * @@ -137,7 +137,7 @@ public class LoadSaveProcess implements Runnable { //===============================CHUNK MAP============================== - private static class Map + private static final class Map { private static int[] lowerleft; private static int[][][][][] allChunkCoords; diff --git a/src/iieLoadSaveEntireWorld/Main.java b/src/iieLoadSaveEntireWorld/Main.java index 71680e6..16bcfdd 100644 --- a/src/iieLoadSaveEntireWorld/Main.java +++ b/src/iieLoadSaveEntireWorld/Main.java @@ -1,5 +1,6 @@ package iieLoadSaveEntireWorld; +import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitTask; @@ -8,21 +9,26 @@ public class Main extends JavaPlugin { static Main plugin; static FileConfiguration config; + static ConfigurationSection unfinished; + static StartCommand start; static StopCommand stop; + static LoadSaveProcess process; static BukkitTask task; public void onEnable() { plugin = this; config = plugin.getConfig(); + unfinished = config.getConfigurationSection("unfinished worlds"); start = new StartCommand(plugin); stop = new StopCommand(plugin); + process = new LoadSaveProcess(); saveDefaultConfig(); getCommand("beginloadsave").setExecutor(start); getCommand("stoploadsave").setExecutor(stop); - Cache.updateListUnfinished(); + Cache.generate(); } }