progress update
This commit is contained in:
parent
841ee979be
commit
f978862cfa
3 changed files with 53 additions and 20 deletions
|
@ -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<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)
|
||||
private static char[][] listUnfinished;
|
||||
private static Map<String,WorldStatus> cacheWorldStatus;
|
||||
|
||||
//PRIVATE METHODS===============================
|
||||
private static char[][] populate(Set<String> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue