mirror of
https://github.com/YouHaveTrouble/BlockEdit.git
synced 2026-06-29 13:36:19 +00:00
preparations for .schematic implementation
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
@@ -32,7 +33,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<version>3.3.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
@@ -41,6 +42,12 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>net.querz</pattern>
|
||||
<shadedPattern>me.youhavetrouble.blockedit.net.querz</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -60,12 +67,8 @@
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>https://repo.dmulloy2.net/repository/public/</url>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
@@ -76,6 +79,11 @@
|
||||
<version>1.19.3-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.Querz</groupId>
|
||||
<artifactId>NBT</artifactId>
|
||||
<version>6.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -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