Fixes
- saveDefaultConfig() - There's no default config in the plugin - The config process didn't put the world name in the config when saving - No plugin.yml - The Main class was created in each class it got referenced (Main plugin=new Main()), Bukkit doesn't allow that - TaskManager.configProcess was never set Still not much for an untested version.
This commit is contained in:
parent
c1ad76fe25
commit
3dfefcb776
10 changed files with 140 additions and 135 deletions
|
@ -5,15 +5,18 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||
public class ConfigProcess implements Runnable {
|
||||
|
||||
//STATIC
|
||||
private static final Main plugin = new Main();
|
||||
private static final FileConfiguration config = plugin.getConfig();
|
||||
private static FileConfiguration config;
|
||||
|
||||
static final boolean isNew(String name)
|
||||
{
|
||||
if(config == null)
|
||||
config = Main.getPlugin().getConfig();
|
||||
return !config.contains(name);
|
||||
}
|
||||
static final WorldObject getUnfinished(String name)
|
||||
{
|
||||
if(config == null)
|
||||
config = Main.getPlugin().getConfig();
|
||||
return new WorldObject
|
||||
(
|
||||
config.getInt(name + ".width"),
|
||||
|
@ -40,19 +43,23 @@ public class ConfigProcess implements Runnable {
|
|||
private final String name = TaskManager.loadProcess.worldname;
|
||||
public final void run()
|
||||
{
|
||||
config.set(".currentRegion.x", TaskManager.loadProcess.currentRegion[0]);
|
||||
config.set(".currentRegion.z", TaskManager.loadProcess.currentRegion[1]);
|
||||
config.set(".n", TaskManager.loadProcess.n);
|
||||
config.set(".c", TaskManager.loadProcess.c);
|
||||
config.set(".D", TaskManager.loadProcess.D);
|
||||
config.set(".d", TaskManager.loadProcess.d);
|
||||
config.set(".B", TaskManager.loadProcess.B ? 1 : 0);
|
||||
plugin.saveConfig();
|
||||
if(config == null)
|
||||
config = Main.getPlugin().getConfig();
|
||||
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);
|
||||
config.set(name + ".c", TaskManager.loadProcess.c);
|
||||
config.set(name + ".D", TaskManager.loadProcess.D);
|
||||
config.set(name + ".d", TaskManager.loadProcess.d);
|
||||
config.set(name + ".B", TaskManager.loadProcess.B ? 1 : 0);
|
||||
Main.getPlugin().saveConfig();
|
||||
}
|
||||
final void finish()
|
||||
{
|
||||
if(config == null)
|
||||
config = Main.getPlugin().getConfig();
|
||||
config.set("finished", name);
|
||||
config.set(name, null);
|
||||
plugin.saveConfig();
|
||||
Main.getPlugin().saveConfig();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,16 @@ package iieLoadSaveEntireWorld;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
private static Main plugin;
|
||||
public static Main getPlugin()
|
||||
{
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public void onEnable()
|
||||
{
|
||||
saveDefaultConfig();
|
||||
//saveDefaultConfig();
|
||||
plugin = this;
|
||||
getCommand("beginfullmapload").setExecutor(new TaskManager.StartCommand());
|
||||
getCommand("stopfullmapload").setExecutor(new TaskManager.StopCommand());
|
||||
}
|
||||
|
|
|
@ -8,9 +8,6 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class TaskManager {
|
||||
|
||||
private static final Main plugin = new Main();
|
||||
|
||||
static boolean inProgress = false;
|
||||
static LoadProcess loadProcess;
|
||||
static ConfigProcess configProcess;
|
||||
|
@ -22,8 +19,9 @@ public class TaskManager {
|
|||
{
|
||||
inProgress = true;
|
||||
TaskManager.loadProcess = loadProcess;
|
||||
TaskManager.loadTask = Bukkit.getScheduler().runTaskTimer( plugin, loadProcess, 0, 10 );
|
||||
TaskManager.configTask = Bukkit.getScheduler().runTaskTimer( plugin, new ConfigProcess(), 0, 200 );
|
||||
TaskManager.configProcess = new ConfigProcess();
|
||||
TaskManager.loadTask = Bukkit.getScheduler().runTaskTimer( Main.getPlugin(), loadProcess, 0, 10 );
|
||||
TaskManager.configTask = Bukkit.getScheduler().runTaskTimer( Main.getPlugin(), configProcess, 0, 200 );
|
||||
}
|
||||
static final void finish()
|
||||
{
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
main: iieLoadSaveEntireWorld.Main
|
||||
version: 1.0.0
|
||||
name: LoadSaveEntireWorld
|
||||
commands:
|
||||
loadsaveentireworld:
|
||||
description: loads and saves the entire map, in 32x32 chunk sections
|
Loading…
Reference in a new issue