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
32
.gitignore
vendored
32
.gitignore
vendored
|
@ -1,17 +1,17 @@
|
||||||
*.class
|
*.class
|
||||||
|
|
||||||
# Mobile Tools for Java (J2ME)
|
# Mobile Tools for Java (J2ME)
|
||||||
.mtj.tmp/
|
.mtj.tmp/
|
||||||
|
|
||||||
# Package Files #
|
# Package Files #
|
||||||
*.jar
|
*.jar
|
||||||
*.war
|
*.war
|
||||||
*.ear
|
*.ear
|
||||||
|
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
hs_err_pid*
|
hs_err_pid*
|
||||||
|
|
||||||
/bin/
|
/bin/
|
||||||
.classpath
|
.classpath
|
||||||
*.classpath
|
*.classpath
|
||||||
/target/
|
/target/
|
||||||
|
|
46
.project
46
.project
|
@ -1,23 +1,23 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>iieLoadSaveEntireWorld</name>
|
<name>iieLoadSaveEntireWorld</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
108
pom.xml
108
pom.xml
|
@ -1,55 +1,55 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.github.TBMCPlugins</groupId>
|
<groupId>com.github.TBMCPlugins</groupId>
|
||||||
<artifactId>Entire-World-Loader</artifactId>
|
<artifactId>Entire-World-Loader</artifactId>
|
||||||
<version>master-SNAPSHOT</version>
|
<version>master-SNAPSHOT</version>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src</directory>
|
<directory>src</directory>
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>**/*.java</exclude>
|
<exclude>**/*.java</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</resource>
|
</resource>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>.</directory>
|
<directory>.</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>*.properties</include>
|
<include>*.properties</include>
|
||||||
<include>*.yml</include>
|
<include>*.yml</include>
|
||||||
<include>*.csv</include>
|
<include>*.csv</include>
|
||||||
<include>*.txt</include>
|
<include>*.txt</include>
|
||||||
</includes>
|
</includes>
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.5.1</version>
|
<version>3.5.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>1.8</source>
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jitpack.io</id>
|
<id>jitpack.io</id>
|
||||||
<url>https://jitpack.io/</url>
|
<url>https://jitpack.io/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.11-R0.1-SNAPSHOT</version>
|
<version>1.11-R0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -5,15 +5,18 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||||
public class ConfigProcess implements Runnable {
|
public class ConfigProcess implements Runnable {
|
||||||
|
|
||||||
//STATIC
|
//STATIC
|
||||||
private static final Main plugin = new Main();
|
private static FileConfiguration config;
|
||||||
private static final FileConfiguration config = plugin.getConfig();
|
|
||||||
|
|
||||||
static final boolean isNew(String name)
|
static final boolean isNew(String name)
|
||||||
{
|
{
|
||||||
|
if(config == null)
|
||||||
|
config = Main.getPlugin().getConfig();
|
||||||
return !config.contains(name);
|
return !config.contains(name);
|
||||||
}
|
}
|
||||||
static final WorldObject getUnfinished(String name)
|
static final WorldObject getUnfinished(String name)
|
||||||
{
|
{
|
||||||
|
if(config == null)
|
||||||
|
config = Main.getPlugin().getConfig();
|
||||||
return new WorldObject
|
return new WorldObject
|
||||||
(
|
(
|
||||||
config.getInt(name + ".width"),
|
config.getInt(name + ".width"),
|
||||||
|
@ -40,19 +43,23 @@ public class ConfigProcess implements Runnable {
|
||||||
private final String name = TaskManager.loadProcess.worldname;
|
private final String name = TaskManager.loadProcess.worldname;
|
||||||
public final void run()
|
public final void run()
|
||||||
{
|
{
|
||||||
config.set(".currentRegion.x", TaskManager.loadProcess.currentRegion[0]);
|
if(config == null)
|
||||||
config.set(".currentRegion.z", TaskManager.loadProcess.currentRegion[1]);
|
config = Main.getPlugin().getConfig();
|
||||||
config.set(".n", TaskManager.loadProcess.n);
|
config.set(name + ".currentRegion.x", TaskManager.loadProcess.currentRegion[0]);
|
||||||
config.set(".c", TaskManager.loadProcess.c);
|
config.set(name + ".currentRegion.z", TaskManager.loadProcess.currentRegion[1]);
|
||||||
config.set(".D", TaskManager.loadProcess.D);
|
config.set(name + ".n", TaskManager.loadProcess.n);
|
||||||
config.set(".d", TaskManager.loadProcess.d);
|
config.set(name + ".c", TaskManager.loadProcess.c);
|
||||||
config.set(".B", TaskManager.loadProcess.B ? 1 : 0);
|
config.set(name + ".D", TaskManager.loadProcess.D);
|
||||||
plugin.saveConfig();
|
config.set(name + ".d", TaskManager.loadProcess.d);
|
||||||
|
config.set(name + ".B", TaskManager.loadProcess.B ? 1 : 0);
|
||||||
|
Main.getPlugin().saveConfig();
|
||||||
}
|
}
|
||||||
final void finish()
|
final void finish()
|
||||||
{
|
{
|
||||||
|
if(config == null)
|
||||||
|
config = Main.getPlugin().getConfig();
|
||||||
config.set("finished", name);
|
config.set("finished", name);
|
||||||
config.set(name, null);
|
config.set(name, null);
|
||||||
plugin.saveConfig();
|
Main.getPlugin().saveConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,16 @@ package iieLoadSaveEntireWorld;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class Main extends JavaPlugin {
|
public class Main extends JavaPlugin {
|
||||||
|
private static Main plugin;
|
||||||
|
public static Main getPlugin()
|
||||||
|
{
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
saveDefaultConfig();
|
//saveDefaultConfig();
|
||||||
|
plugin = this;
|
||||||
getCommand("beginfullmapload").setExecutor(new TaskManager.StartCommand());
|
getCommand("beginfullmapload").setExecutor(new TaskManager.StartCommand());
|
||||||
getCommand("stopfullmapload").setExecutor(new TaskManager.StopCommand());
|
getCommand("stopfullmapload").setExecutor(new TaskManager.StopCommand());
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,6 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
public class TaskManager {
|
public class TaskManager {
|
||||||
|
|
||||||
private static final Main plugin = new Main();
|
|
||||||
|
|
||||||
static boolean inProgress = false;
|
static boolean inProgress = false;
|
||||||
static LoadProcess loadProcess;
|
static LoadProcess loadProcess;
|
||||||
static ConfigProcess configProcess;
|
static ConfigProcess configProcess;
|
||||||
|
@ -22,8 +19,9 @@ public class TaskManager {
|
||||||
{
|
{
|
||||||
inProgress = true;
|
inProgress = true;
|
||||||
TaskManager.loadProcess = loadProcess;
|
TaskManager.loadProcess = loadProcess;
|
||||||
TaskManager.loadTask = Bukkit.getScheduler().runTaskTimer( plugin, loadProcess, 0, 10 );
|
TaskManager.configProcess = new ConfigProcess();
|
||||||
TaskManager.configTask = Bukkit.getScheduler().runTaskTimer( plugin, new ConfigProcess(), 0, 200 );
|
TaskManager.loadTask = Bukkit.getScheduler().runTaskTimer( Main.getPlugin(), loadProcess, 0, 10 );
|
||||||
|
TaskManager.configTask = Bukkit.getScheduler().runTaskTimer( Main.getPlugin(), configProcess, 0, 200 );
|
||||||
}
|
}
|
||||||
static final void finish()
|
static final void finish()
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class WorldObject {
|
||||||
//add margins------------
|
//add margins------------
|
||||||
|
|
||||||
final int[] edges = new int[4];
|
final int[] edges = new int[4];
|
||||||
final int[] radii = new int[4];
|
final int[] radii = new int[4];
|
||||||
final boolean[] margin = new boolean[4];
|
final boolean[] margin = new boolean[4];
|
||||||
|
|
||||||
//get block edge farthest from center
|
//get block edge farthest from center
|
||||||
|
@ -144,15 +144,15 @@ public class WorldObject {
|
||||||
if (!margin[3])//-----------0000
|
if (!margin[3])//-----------0000
|
||||||
return bounds;
|
return bounds;
|
||||||
else//----------------------0001
|
else//----------------------0001
|
||||||
if (radii[0] < radii[1])
|
if (radii[0] < radii[1])
|
||||||
bounds[0]++;
|
bounds[0]++;
|
||||||
else
|
else
|
||||||
bounds[1]++;
|
bounds[1]++;
|
||||||
else
|
else
|
||||||
if (!margin[3])//-----------0010
|
if (!margin[3])//-----------0010
|
||||||
if (radii[0] < radii[1])
|
if (radii[0] < radii[1])
|
||||||
bounds[0]++;
|
bounds[0]++;
|
||||||
else
|
else
|
||||||
bounds[1]++;
|
bounds[1]++;
|
||||||
else//----------------------0011
|
else//----------------------0011
|
||||||
{
|
{
|
||||||
|
@ -162,7 +162,7 @@ public class WorldObject {
|
||||||
else
|
else
|
||||||
if (!margin[2])
|
if (!margin[2])
|
||||||
if (!margin[3])//-----------0100
|
if (!margin[3])//-----------0100
|
||||||
if (radii[2] < radii[3])
|
if (radii[2] < radii[3])
|
||||||
bounds[2]++;
|
bounds[2]++;
|
||||||
else
|
else
|
||||||
bounds[3]++;
|
bounds[3]++;
|
||||||
|
@ -198,9 +198,9 @@ public class WorldObject {
|
||||||
if (margin[3])//------------1001
|
if (margin[3])//------------1001
|
||||||
return bounds;
|
return bounds;
|
||||||
else//----------------------1000
|
else//----------------------1000
|
||||||
if (radii[2] == radii[3])
|
if (radii[2] == radii[3])
|
||||||
bounds[0]++;
|
bounds[0]++;
|
||||||
else
|
else
|
||||||
bounds[1]++;
|
bounds[1]++;
|
||||||
|
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
|
@ -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