diff --git a/pom.xml b/pom.xml index 35929a1..9560ada 100644 --- a/pom.xml +++ b/pom.xml @@ -20,6 +20,7 @@ + org.apache.maven.plugins maven-compiler-plugin @@ -32,7 +33,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.4 + 3.3.0 package @@ -41,6 +42,12 @@ false + + + net.querz + me.youhavetrouble.blockedit.net.querz + + @@ -60,12 +67,8 @@ https://papermc.io/repo/repository/maven-public/ - sonatype - https://oss.sonatype.org/content/groups/public/ - - - dmulloy2-repo - https://repo.dmulloy2.net/repository/public/ + jitpack.io + https://jitpack.io @@ -76,6 +79,11 @@ 1.19.3-R0.1-SNAPSHOT provided - + + com.github.Querz + NBT + 6.1 + compile + diff --git a/src/main/java/me/youhavetrouble/blockedit/BlockEdit.java b/src/main/java/me/youhavetrouble/blockedit/BlockEdit.java index c42bbe9..1afd6d8 100644 --- a/src/main/java/me/youhavetrouble/blockedit/BlockEdit.java +++ b/src/main/java/me/youhavetrouble/blockedit/BlockEdit.java @@ -10,6 +10,8 @@ public final class BlockEdit extends JavaPlugin { private static BlockEdit plugin; + private static SchematicHandler schematicHandler; + @Override public void onEnable() { plugin = this; @@ -30,6 +32,9 @@ public final class BlockEdit extends JavaPlugin { registerCommand(new PasteCommand()); registerCommand(new RotateCommand()); + schematicHandler = new SchematicHandler(this); + + } @@ -37,7 +42,12 @@ public final class BlockEdit extends JavaPlugin { return plugin; } + public static SchematicHandler getSchematicHandler() { + return schematicHandler; + } + private void registerCommand(Command command) { getServer().getCommandMap().register("blockedit", command); } + } diff --git a/src/main/java/me/youhavetrouble/blockedit/SchematicHandler.java b/src/main/java/me/youhavetrouble/blockedit/SchematicHandler.java new file mode 100644 index 0000000..aea36f0 --- /dev/null +++ b/src/main/java/me/youhavetrouble/blockedit/SchematicHandler.java @@ -0,0 +1,51 @@ +package me.youhavetrouble.blockedit; + +import me.youhavetrouble.blockedit.util.Clipboard; + +import java.io.File; + +public class SchematicHandler { + + private final BlockEdit plugin; + + protected SchematicHandler(BlockEdit plugin) { + this.plugin = plugin; + createSchematicsDirectory(); + } + + private void createSchematicsDirectory() { + try { + if (!plugin.getDataFolder().exists()) { + plugin.getDataFolder().mkdir(); + } + File schematicsDir = new File(plugin.getDataFolder(), "schematics"); + if (!schematicsDir.exists()) { + schematicsDir.mkdir(); + } + } catch (SecurityException e) { + plugin.getLogger().warning("Could not create schematics directory. Make sure server has read/write access to the plugin folder."); + } + + } + + /** + * Loads a schematic from the schematics directory + * @param schematicName Name of the schematic + * @return Clipboard object containing the schematic + */ + public Clipboard loadSchematic(String schematicName) { + return null; + } + + /** + * Saves a schematic to the schematics directory + * @param schematicName Name of the schematic + * @param clipboard Clipboard object containing the schematic + */ + public void saveSchematic(String schematicName, Clipboard clipboard) { + + } + + + +} diff --git a/src/main/java/me/youhavetrouble/blockedit/api/BlockEditAPI.java b/src/main/java/me/youhavetrouble/blockedit/api/BlockEditAPI.java index b8ce741..75ce265 100644 --- a/src/main/java/me/youhavetrouble/blockedit/api/BlockEditAPI.java +++ b/src/main/java/me/youhavetrouble/blockedit/api/BlockEditAPI.java @@ -1,5 +1,7 @@ package me.youhavetrouble.blockedit.api; +import me.youhavetrouble.blockedit.BlockEdit; +import me.youhavetrouble.blockedit.SchematicHandler; import me.youhavetrouble.blockedit.util.ChunkWork; import me.youhavetrouble.blockedit.util.Selection; @@ -17,4 +19,11 @@ public class BlockEditAPI { WorkSplitter.runOperation(work, selection, chunksPerTick, operation); } + /** + * Gets schematic handler object that can be used to work with schematics + * @return Schematic handler + */ + public SchematicHandler getSchematicHandler() { + return BlockEdit.getSchematicHandler(); + } }