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
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
/bin/
|
||||
.classpath
|
||||
*.classpath
|
||||
*.class
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
/bin/
|
||||
.classpath
|
||||
*.classpath
|
||||
/target/
|
||||
|
|
46
.project
46
.project
|
@ -1,23 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>iieLoadSaveEntireWorld</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>iieLoadSaveEntireWorld</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
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"
|
||||
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>
|
||||
<groupId>com.github.TBMCPlugins</groupId>
|
||||
<artifactId>Entire-World-Loader</artifactId>
|
||||
<version>master-SNAPSHOT</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>.</directory>
|
||||
<includes>
|
||||
<include>*.properties</include>
|
||||
<include>*.yml</include>
|
||||
<include>*.csv</include>
|
||||
<include>*.txt</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.11-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.TBMCPlugins</groupId>
|
||||
<artifactId>Entire-World-Loader</artifactId>
|
||||
<version>master-SNAPSHOT</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>.</directory>
|
||||
<includes>
|
||||
<include>*.properties</include>
|
||||
<include>*.yml</include>
|
||||
<include>*.csv</include>
|
||||
<include>*.txt</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.11-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -116,7 +116,7 @@ public class WorldObject {
|
|||
//add margins------------
|
||||
|
||||
final int[] edges = new int[4];
|
||||
final int[] radii = new int[4];
|
||||
final int[] radii = new int[4];
|
||||
final boolean[] margin = new boolean[4];
|
||||
|
||||
//get block edge farthest from center
|
||||
|
@ -144,15 +144,15 @@ public class WorldObject {
|
|||
if (!margin[3])//-----------0000
|
||||
return bounds;
|
||||
else//----------------------0001
|
||||
if (radii[0] < radii[1])
|
||||
if (radii[0] < radii[1])
|
||||
bounds[0]++;
|
||||
else
|
||||
bounds[1]++;
|
||||
else
|
||||
if (!margin[3])//-----------0010
|
||||
if (radii[0] < radii[1])
|
||||
if (radii[0] < radii[1])
|
||||
bounds[0]++;
|
||||
else
|
||||
else
|
||||
bounds[1]++;
|
||||
else//----------------------0011
|
||||
{
|
||||
|
@ -162,7 +162,7 @@ public class WorldObject {
|
|||
else
|
||||
if (!margin[2])
|
||||
if (!margin[3])//-----------0100
|
||||
if (radii[2] < radii[3])
|
||||
if (radii[2] < radii[3])
|
||||
bounds[2]++;
|
||||
else
|
||||
bounds[3]++;
|
||||
|
@ -198,9 +198,9 @@ public class WorldObject {
|
|||
if (margin[3])//------------1001
|
||||
return bounds;
|
||||
else//----------------------1000
|
||||
if (radii[2] == radii[3])
|
||||
if (radii[2] == radii[3])
|
||||
bounds[0]++;
|
||||
else
|
||||
else
|
||||
bounds[1]++;
|
||||
|
||||
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