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:
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
@@ -32,7 +33,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.2.4</version>
|
<version>3.3.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
@@ -41,6 +42,12 @@
|
|||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>net.querz</pattern>
|
||||||
|
<shadedPattern>me.youhavetrouble.blockedit.net.querz</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
@@ -60,12 +67,8 @@
|
|||||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>sonatype</id>
|
<id>jitpack.io</id>
|
||||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
<url>https://jitpack.io</url>
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>dmulloy2-repo</id>
|
|
||||||
<url>https://repo.dmulloy2.net/repository/public/</url>
|
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
@@ -76,6 +79,11 @@
|
|||||||
<version>1.19.3-R0.1-SNAPSHOT</version>
|
<version>1.19.3-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.Querz</groupId>
|
||||||
|
<artifactId>NBT</artifactId>
|
||||||
|
<version>6.1</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ public final class BlockEdit extends JavaPlugin {
|
|||||||
|
|
||||||
private static BlockEdit plugin;
|
private static BlockEdit plugin;
|
||||||
|
|
||||||
|
private static SchematicHandler schematicHandler;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
plugin = this;
|
plugin = this;
|
||||||
@@ -30,6 +32,9 @@ public final class BlockEdit extends JavaPlugin {
|
|||||||
registerCommand(new PasteCommand());
|
registerCommand(new PasteCommand());
|
||||||
registerCommand(new RotateCommand());
|
registerCommand(new RotateCommand());
|
||||||
|
|
||||||
|
schematicHandler = new SchematicHandler(this);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +42,12 @@ public final class BlockEdit extends JavaPlugin {
|
|||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SchematicHandler getSchematicHandler() {
|
||||||
|
return schematicHandler;
|
||||||
|
}
|
||||||
|
|
||||||
private void registerCommand(Command command) {
|
private void registerCommand(Command command) {
|
||||||
getServer().getCommandMap().register("blockedit", 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;
|
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.ChunkWork;
|
||||||
import me.youhavetrouble.blockedit.util.Selection;
|
import me.youhavetrouble.blockedit.util.Selection;
|
||||||
|
|
||||||
@@ -17,4 +19,11 @@ public class BlockEditAPI {
|
|||||||
WorkSplitter.runOperation(work, selection, chunksPerTick, operation);
|
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