mirror of
https://github.com/YouHaveTrouble/BlockEdit.git
synced 2026-06-29 21:46:19 +00:00
preparations for .schematic implementation
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user