commit e3385c78974da112d4510e8f153eb1a645fbd4e3 Author: iie Date: Fri Jun 23 18:12:19 2017 +0200 Updated to 1.12 This is code is amazingly short diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..0a1dadd --- /dev/null +++ b/.classpath @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/.project b/.project new file mode 100644 index 0000000..fe72bb0 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + ChunkArchive + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..f9fe345 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..abec6ca --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..c6d52f7 --- /dev/null +++ b/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + + buttondevteam + ChunkArchive + 0.0.1-SNAPSHOT + jar + + + + src + + **/*.java + + + + . + + + + + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + jitpack.io + https://jitpack.io/ + + + + + org.spigotmc + spigot-api + 1.12-R0.1-SNAPSHOT + provided + + + org.bukkit + craftbukkit + 1.12-R0.1-SNAPSHOT + provided + + + junit + junit + 3.8.1 + test + + + diff --git a/src/main/java/buttondevteam/ChunkArchive/Main.java b/src/main/java/buttondevteam/ChunkArchive/Main.java new file mode 100644 index 0000000..6d81faf --- /dev/null +++ b/src/main/java/buttondevteam/ChunkArchive/Main.java @@ -0,0 +1,41 @@ +package buttondevteam.ChunkArchive; + +import java.io.IOException; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftChunk; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; +import org.bukkit.craftbukkit.v1_12_R1.CraftWorld; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.world.ChunkPopulateEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import net.minecraft.server.v1_12_R1.ChunkRegionLoader; +import net.minecraft.server.v1_12_R1.ExceptionWorldConflict; + +public class Main extends JavaPlugin implements Listener +{ + public void onEnable() + { + getServer().getPluginManager().registerEvents(this, this); + } + /*------------------------------------------------------------*/ + + private final ChunkRegionLoader chunkRegionLoader = + + new ChunkRegionLoader(this.getDataFolder(), ((CraftServer) Bukkit.getServer()) + .getServer() + .dataConverterManager); + + /*------------------------------------------------------------*/ + + @EventHandler + public void onChunkPopulate(ChunkPopulateEvent event) throws IOException, + ExceptionWorldConflict + { + if (event.getWorld().getName().equals("world")) + chunkRegionLoader.a(((CraftWorld) event.getWorld()).getHandle(), + ((CraftChunk) event.getChunk()).getHandle()); + } +} diff --git a/src/test/java/buttondevteam/ChunkArchive/AppTest.java b/src/test/java/buttondevteam/ChunkArchive/AppTest.java new file mode 100644 index 0000000..4a413d6 --- /dev/null +++ b/src/test/java/buttondevteam/ChunkArchive/AppTest.java @@ -0,0 +1,38 @@ +package buttondevteam.ChunkArchive; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +}