diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SchematicBrush.kt b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SchematicBrush.kt index 3a78e1c4..71a598eb 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SchematicBrush.kt +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SchematicBrush.kt @@ -4,19 +4,22 @@ import com.github.kevindagame.snipe.SnipeData import com.github.kevindagame.util.Messages import com.github.kevindagame.util.VoxelMessage import com.github.kevindagame.util.brushOperation.BlockOperation -import com.github.kevindagame.util.schematic.SchematicReader -import com.github.kevindagame.util.schematic.VoxelSchematic -import com.github.kevindagame.util.schematic.VoxelSchematicBlock +import com.github.kevindagame.util.schematic.* import com.github.kevindagame.voxelsniper.location.BaseLocation import com.github.kevindagame.voxelsniper.material.VoxelMaterial class SchematicBrush : AbstractBrush() { + private val schematicLoader: VoxelSchematicLoader private lateinit var schematicName: String private lateinit var schematics: List private var mode = PasteMode.FULL private var rotation = RotateMode.DEGREES_0 private var flip = FlipMode.NONE + init { + val schematicReader: ISchematicReader = DataFolderSchematicReader() + this.schematicLoader = VoxelSchematicLoader(schematicReader) + } override fun info(vm: VoxelMessage) { vm.brushName(this.name) vm.custom(Messages.CHOSEN_SCHEMATIC.replace("%schematics%", if(this::schematics.isInitialized) schematics.joinToString(", ") { it.name } else "None")) @@ -148,13 +151,13 @@ class SchematicBrush : AbstractBrush() { if (params.isNotEmpty()) { when (params[0]) { "list" -> { - v.sendMessage(Messages.SCHEMATIC_LIST.replace("%schematics%", SchematicReader.getPossibleNames().joinToString(", "))) + v.sendMessage(Messages.SCHEMATIC_LIST.replace("%schematics%", schematicLoader.getSchematicNamesForAutoComplete().joinToString(", "))) } "schem" -> { if (params.size > 1) { try { - val schematics = SchematicReader.read(params[1]) + val schematics = schematicLoader.gatherSchematics(params[1]) this.schematicName = params[1] this.schematics = schematics if (schematics.size == 1) { @@ -163,7 +166,7 @@ class SchematicBrush : AbstractBrush() { v.sendMessage(Messages.SCHEMATIC_LOADED_MULTIPLE.replace("%schematics%", this.schematics.joinToString(", ") { it.name })) } } catch (e: IllegalArgumentException) { - v.sendMessage(Messages.INVALID_BRUSH_PARAM) + v.sendMessage(Messages.FILE_LOAD_FAIL.replace("%exception.getMessage%", e.message ?: "Unknown error")) } } } @@ -202,6 +205,10 @@ class SchematicBrush : AbstractBrush() { } } + else -> { + v.sendMessage(Messages.INVALID_BRUSH_PARAM) + } + } } } @@ -212,7 +219,7 @@ class SchematicBrush : AbstractBrush() { override fun registerArgumentValues(): HashMap> { return hashMapOf( - "schem" to SchematicReader.getPossibleNames(), + "schem" to schematicLoader.getSchematicNamesForAutoComplete(), "rotate" to RotateMode.values().map { it.name.lowercase().replace("degrees_", "") }, "flip" to FlipMode.values().map { it.name.lowercase() }, "mode" to PasteMode.values().map { it.name.lowercase() }, diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelCommand.java index f628a360..f5914f25 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelCommand.java @@ -24,7 +24,13 @@ public VoxelCommand(String name) { public boolean execute(IPlayer player, String[] args) { if (getPermission() == null || getPermission().isEmpty() || player.hasPermission(getPermission())) { - return doCommand(player, args); + try { + return doCommand(player, args); + } catch (Exception e) { + e.printStackTrace(); + player.sendMessage(Messages.COMMAND_ERROR); + return true; + } } else { player.sendMessage(Messages.NO_PERMISSION_MESSAGE.replace("%permission%", getPermission())); return true; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Messages.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Messages.java index 4a043a8e..6801bf9a 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Messages.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Messages.java @@ -372,7 +372,7 @@ public enum Messages implements ComponentLike { SCHEMATIC_SET_ROTATION, SCHEMATIC_SET_FLIP, SCHEMATIC_SET_MODE, - ; + COMMAND_ERROR; // diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/schematic/DataFolderSchematicReader.kt b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/schematic/DataFolderSchematicReader.kt new file mode 100644 index 00000000..cb434cc6 --- /dev/null +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/schematic/DataFolderSchematicReader.kt @@ -0,0 +1,115 @@ +package com.github.kevindagame.util.schematic + +import com.github.kevindagame.VoxelSniper +import net.sandrohc.schematic4j.SchematicFormat +import net.sandrohc.schematic4j.SchematicLoader +import net.sandrohc.schematic4j.schematic.Schematic +import java.io.File +import java.util.* + +class DataFolderSchematicReader : ISchematicReader { + override fun getSchematicFile(name: String): File? { + //check for exact name + val exactSchematic = VoxelSniper.voxelsniper.fileHandler.getDataFile(SCHEMATIC_FILE_ROOT_PATH + name) + if (exactSchematic.isFile) { + return exactSchematic + } + + //if no, check for name with any extension + val schematicFiles = VoxelSniper.voxelsniper.fileHandler.getDataFile(SCHEMATIC_FILE_ROOT_PATH).listFiles() + if (schematicFiles != null) { + for (schematic in schematicFiles) { + if (schematic.isFile) { + if (schematic.nameWithoutExtension == name) { + return schematic + } + } + } + } + + return null + } + + override fun getSchematicFolder(name: String): File? { + val path = SCHEMATIC_FILE_ROOT_PATH + name + val schematicFolder = VoxelSniper.voxelsniper.fileHandler.getDataFile(path) + if (schematicFolder.isDirectory) { + return schematicFolder + } + return null + } + + override fun readSchematicFile(file: File): VoxelSchematic { + val schematic: Schematic + try { + schematic = SchematicLoader.load(file) + } catch (e: Exception) { + throw IllegalArgumentException("Schematic ${file.name} is not valid") + } + + val voxelSchematicBuilder = VoxelSchematicBuilder() + + voxelSchematicBuilder.name = file.nameWithoutExtension + + schematic.blocks().forEach { block -> + voxelSchematicBuilder.addBlock( + block.left.x.toDouble(), + block.left.y.toDouble(), + block.left.z.toDouble(), + block.right + ) + } + return voxelSchematicBuilder.build() + } + + override fun readSchematicFolder(folder: File): List { + val schematics = mutableListOf() + + val schematicFiles = folder.listFiles() ?: throw IllegalStateException("Folder $folder does not exist") + + for (schematicFile in schematicFiles) { + if (schematicFile.isFile) { + + schematics.add(readSchematicFile(schematicFile)) + } + + } + return schematics + } + + override fun getPossibleSchematicNames(): List { + val schematics = mutableListOf() + val schematicsFolder = VoxelSniper.voxelsniper.fileHandler.getDataFile(SCHEMATIC_FILE_ROOT_PATH) + if (schematicsFolder.exists()) { + val files = schematicsFolder.listFiles() + if (files != null) { + for (file in files) { + if (file.isFile) { + schematics.add(file.nameWithoutExtension) + } else if (file.isDirectory) { + if (file.listFiles()?.any { SCHEMATIC_VALID_EXTENSIONS.contains(it.extension) } == true) { + schematics.add(file.name) + } + } + } + } + } + return schematics + } + + companion object { + const val SCHEMATIC_FILE_ROOT_PATH = "schematics/" + + val SCHEMATIC_VALID_EXTENSIONS: List = Arrays.stream(SchematicFormat.values()) + .map { f: SchematicFormat -> f.fileExtension } + .distinct() + .toList() + + fun initialize() { + val schematicsFolder = VoxelSniper.voxelsniper.fileHandler.getDataFile("schematics") + if (!schematicsFolder.exists()) { + schematicsFolder.mkdir() + } + } + } +} \ No newline at end of file diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/schematic/ISchematicReader.kt b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/schematic/ISchematicReader.kt new file mode 100644 index 00000000..ae434782 --- /dev/null +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/schematic/ISchematicReader.kt @@ -0,0 +1,12 @@ +package com.github.kevindagame.util.schematic + +import java.io.File + +interface ISchematicReader { + fun getSchematicFile(name: String): File? + fun getSchematicFolder(name: String): File? + + fun readSchematicFile(file: File): VoxelSchematic? + fun readSchematicFolder(folder: File): List + fun getPossibleSchematicNames(): List +} diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/schematic/SchematicReader.kt b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/schematic/SchematicReader.kt deleted file mode 100644 index 403974d6..00000000 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/schematic/SchematicReader.kt +++ /dev/null @@ -1,122 +0,0 @@ -package com.github.kevindagame.util.schematic - -import com.github.kevindagame.VoxelSniper -import net.sandrohc.schematic4j.SchematicLoader - -import java.io.File - -object SchematicReader { - - private fun readSchematic(file: File): VoxelSchematic { - val schematic = SchematicLoader.load(file) - val voxelSchematicBuilder = VoxelSchematicBuilder() - - voxelSchematicBuilder.name = file.nameWithoutExtension - - for (y in 0 until schematic.height()) { - for (x in 0 until schematic.width()) { - for (z in 0 until schematic.length()) { - - val block = schematic.block(x,y,z) - voxelSchematicBuilder.addBlock(x.toDouble(), y.toDouble(), z.toDouble(), block) - } - } - } - return voxelSchematicBuilder.build() - } - - private fun readSchematics(folder: File): MutableList { - if (!folder.exists()) { - throw IllegalArgumentException("Folder $folder does not exist") - } - val schematicFiles = folder.listFiles() - if (schematicFiles != null) { - if(schematicFiles.none { it.extension == "schem" }) { - throw IllegalArgumentException("Folder $folder does not contain any schematics") - } - } - val schematics = mutableListOf() - if (schematicFiles != null) { - for (schematic in schematicFiles) { - if (schematic.isFile) { - if (schematic.extension == "schem") { - schematics.add(readSchematic(schematic)) - } - } - } - } - return schematics - } - - /** - * Reads a schematic from a file or a folder. - * If the name ends with .schem, then it will read the file. - * If there is no file with the name.schem, then it will throw an IllegalArgumentException. - * If the name does not end with .schem, then it will check if there is a folder with that name. - * If there is a folder with that name, then it will read all schematics in that folder. - * If there are no schematics in that folder, then it will throw an IllegalArgumentException. - * If there is no folder with that name, then it will check if there is a file with the name.schem. - * If there is a file with the name.schem, then it will read the file. - * If there is no file with the name.schem, then it will throw an IllegalArgumentException. - * @param name The name of the schematic or the folder. - * @return A list of schematics. - * @throws IllegalArgumentException If there is no file with the name.schem or no folder with that name. - */ - fun read(name: String): List { - - //if name ends with .schem, then check if it exists. if yes, then call readFile with the file. - if (name.endsWith(".schem")) { - val file = VoxelSniper.voxelsniper.fileHandler.getDataFile("schematics/$name") - if (!file.exists()) { - throw IllegalArgumentException("File $name does not exist") - } - return listOf(readSchematic(file)) - } - - // If name does not end with .schem, then check if there is a folder with that name. If yes, then call readFolder with the folder. - val folder = VoxelSniper.voxelsniper.fileHandler.getDataFile("schematics/$name") - if (folder.exists()) { - return readSchematics(folder) - } - - // If no, check if there is a file with the name.schem. If yes, then call readFile with the file. - val file = VoxelSniper.voxelsniper.fileHandler.getDataFile("schematics/$name.schem") - if (file.exists()) { - return listOf(readSchematic(file)) - } - - // If no, then throw an exception. - throw IllegalArgumentException("File $name does not exist") - - } - - fun getPossibleNames(): List { - val schematicsFolder = VoxelSniper.voxelsniper.fileHandler.getDataFile("schematics") - val schematics = mutableListOf() - if (schematicsFolder.exists()) { - val files = schematicsFolder.listFiles() - if (files != null) { - for (file in files) { - if (file.isFile) { - if (file.extension == "schem") { - schematics.add(file.nameWithoutExtension) - } - } else if (file.isDirectory) { - if (file.listFiles()?.any { it.extension == "schem" } == true) { - schematics.add(file.name) - } - } - } - } - } - return schematics - } - - @JvmStatic - fun initialize() { - val schematicsFolder = VoxelSniper.voxelsniper.fileHandler.getDataFile("schematics") - if (!schematicsFolder.exists()) { - schematicsFolder.mkdir() - } - } -} \ No newline at end of file diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/schematic/VoxelSchematicLoader.kt b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/schematic/VoxelSchematicLoader.kt new file mode 100644 index 00000000..544eb66f --- /dev/null +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/schematic/VoxelSchematicLoader.kt @@ -0,0 +1,41 @@ +package com.github.kevindagame.util.schematic + +class VoxelSchematicLoader(private val schematicReader: ISchematicReader) { + /** + * Reads a schematic from a file or a folder. + * check if there is a folder with the name. + * If there is a folder with that name, then it will read all schematics in that folder. + * If there are no schematics in that folder, then it will throw an IllegalArgumentException. + * If there is no folder with that name, then it will check if there is a file with the .schem. + * If there is a file with the .schem, then it will read the file. + * If there is no file with the .schem, then it will throw an IllegalArgumentException. + * + * @param name The name of the schematic or the folder. + * @return A list of schematics. + * @throws IllegalArgumentException If there is no file with the .schem or no folder with that name. + */ + fun gatherSchematics(name: String): List { + val schematicFolder = schematicReader.getSchematicFolder(name) + if (schematicFolder != null) { + val schematics = schematicReader.readSchematicFolder(schematicFolder) + if (schematics.isEmpty()) { + throw IllegalArgumentException("Folder $name does not contain any schematics") + } + return schematics + } + + val schematicFile = schematicReader.getSchematicFile(name) + if (schematicFile != null) { + val schematic = schematicReader.readSchematicFile(schematicFile) + ?: throw IllegalArgumentException("Schematic $name is not valid") + + return listOf(schematic) + } + + throw IllegalArgumentException("No schematic file or folder with name $name") + } + + fun getSchematicNamesForAutoComplete(): List { + return schematicReader.getPossibleSchematicNames() + } +} \ No newline at end of file diff --git a/VoxelSniperCore/src/main/resources/lang.yml b/VoxelSniperCore/src/main/resources/lang.yml index 49eed365..10c4f760 100644 --- a/VoxelSniperCore/src/main/resources/lang.yml +++ b/VoxelSniperCore/src/main/resources/lang.yml @@ -603,4 +603,5 @@ SCHEMATIC_LOADED_ONE: "Loaded schematic: %schematic%" SCHEMATIC_LOADED_MULTIPLE: "Loaded schematics: %schematics%" SCHEMATIC_SET_ROTATION: "Rotation set to: %rotation% degrees" SCHEMATIC_SET_FLIP: "Flip set to: %flip%" -SCHEMATIC_SET_MODE: "Paste mode set to: %mode%" \ No newline at end of file +SCHEMATIC_SET_MODE: "Paste mode set to: %mode%" +COMMAND_ERROR: "Something went wrong while executing this command" \ No newline at end of file diff --git a/VoxelSniperCore/src/test/java/com/github/kevindagame/util/schematic/VoxelSchematicLoaderTest.kt b/VoxelSniperCore/src/test/java/com/github/kevindagame/util/schematic/VoxelSchematicLoaderTest.kt new file mode 100644 index 00000000..74b418fc --- /dev/null +++ b/VoxelSniperCore/src/test/java/com/github/kevindagame/util/schematic/VoxelSchematicLoaderTest.kt @@ -0,0 +1,142 @@ +package com.github.kevindagame.util.schematic + +import org.junit.Test +import org.mockito.Mockito +import java.io.File + +class VoxelSchematicLoaderTest { + + @Test + fun gatherSchematics_match_empty_folder_throw_IllegalArgumentException() { + // Arrange + val folder = File("empty_folder") + val schematicReaderMock = Mockito.mock(ISchematicReader::class.java) + Mockito.`when`(schematicReaderMock.getSchematicFolder("empty_folder")).thenReturn(folder) + Mockito.`when`(schematicReaderMock.readSchematicFolder(folder)).thenReturn(emptyList()) + + val schematicLoader = VoxelSchematicLoader(schematicReaderMock) + + val name = "empty_folder" + + // Act + val exception = try { + schematicLoader.gatherSchematics(name) + null + } catch (e: IllegalArgumentException) { + e + } + + // Assert + assert(exception != null) + assert(exception!!.message!!.contains(name)) + } + + @Test + fun gatherSchematics_match_non_empty_folder_returns_Schematics() { + // Arrange + val folder = File("empty_folder") + val schematicInFolder = VoxelSchematic(listOf(), "Fancy tree") + val schematicReaderMock = Mockito.mock(ISchematicReader::class.java) + Mockito.`when`(schematicReaderMock.getSchematicFolder("empty_folder")).thenReturn(folder) + Mockito.`when`(schematicReaderMock.readSchematicFolder(folder)).thenReturn(listOf(schematicInFolder)) + + val schematicLoader = VoxelSchematicLoader(schematicReaderMock) + val name = "empty_folder" + + // Act + val schematics = schematicLoader.gatherSchematics(name) + + // Assert + assert(schematics.size == 1) + assert(schematics[0] == schematicInFolder) + } + + @Test + fun gatherSchematics_match_file_returns_Schematic() { + // Arrange + val schematicFile = File("fancy_tree.schem") + val schematic = VoxelSchematic(listOf(), "Fancy tree") + val schematicReaderMock = Mockito.mock(ISchematicReader::class.java) + + Mockito.`when`(schematicReaderMock.getSchematicFolder("fancy_tree")).thenReturn(null) + Mockito.`when`(schematicReaderMock.getSchematicFile("fancy_tree")).thenReturn(schematicFile) + Mockito.`when`(schematicReaderMock.readSchematicFile(schematicFile)).thenReturn(schematic) + + val schematicLoader = VoxelSchematicLoader(schematicReaderMock) + val name = "fancy_tree" + + // Act + val schematics = schematicLoader.gatherSchematics(name) + + // Assert + assert(schematics.size == 1) + assert(schematics[0] == schematic) + } + + @Test + fun gatherSchematics_match_file_but_null_throws_IllegalArgumentException() { + // Arrange + val schematicFile = File("fancy_tree.schem") + val schematicReaderMock = Mockito.mock(ISchematicReader::class.java) + + Mockito.`when`(schematicReaderMock.getSchematicFolder("fancy_tree")).thenReturn(null) + Mockito.`when`(schematicReaderMock.getSchematicFile("fancy_tree")).thenReturn(schematicFile) + Mockito.`when`(schematicReaderMock.readSchematicFile(schematicFile)).thenReturn(null) + + val schematicLoader = VoxelSchematicLoader(schematicReaderMock) + val name = "fancy_tree" + + // Act + val exception = try { + schematicLoader.gatherSchematics(name) + null + } catch (e: IllegalArgumentException) { + e + } + + // Assert + assert(exception != null) + assert(exception!!.message!!.contains(name)) + } + + @Test + fun gatherSchematics_no_match_throws_IllegalArgumentException() { + // Arrange + val schematicReaderMock = Mockito.mock(ISchematicReader::class.java) + + Mockito.`when`(schematicReaderMock.getSchematicFolder("fancy_tree")).thenReturn(null) + Mockito.`when`(schematicReaderMock.getSchematicFile("fancy_tree")).thenReturn(null) + + val schematicLoader = VoxelSchematicLoader(schematicReaderMock) + val name = "fancy_tree" + + // Act + val exception = try { + schematicLoader.gatherSchematics(name) + null + } catch (e: IllegalArgumentException) { + e + } + + // Assert + assert(exception != null) + assert(exception!!.message!!.contains(name)) + } + + @Test + fun `getSchematicNamesForAutoComplete should return list of schematic names`() { + // Arrange + val expectedSchematicNames = listOf("schematic1", "schematic2", "schematic3") + + val schematicReader = Mockito.mock(ISchematicReader::class.java) + Mockito.`when`(schematicReader.getPossibleSchematicNames()).thenReturn(expectedSchematicNames) + val schematicLoader = VoxelSchematicLoader(schematicReader) + + //Act + val schematicNames = schematicLoader.getSchematicNamesForAutoComplete() + + // Assert + assert(schematicNames == expectedSchematicNames) + } + +} \ No newline at end of file diff --git a/VoxelSniperFabric/src/main/java/com/github/kevdadev/voxelsniperfabric/VoxelSniperFabric.kt b/VoxelSniperFabric/src/main/java/com/github/kevdadev/voxelsniperfabric/VoxelSniperFabric.kt index 634c9d0d..6ee09130 100644 --- a/VoxelSniperFabric/src/main/java/com/github/kevdadev/voxelsniperfabric/VoxelSniperFabric.kt +++ b/VoxelSniperFabric/src/main/java/com/github/kevdadev/voxelsniperfabric/VoxelSniperFabric.kt @@ -7,7 +7,7 @@ import com.github.kevindagame.VoxelBrushManager import com.github.kevindagame.VoxelSniper import com.github.kevindagame.command.VoxelCommandManager import com.github.kevindagame.util.Messages -import com.github.kevindagame.util.schematic.SchematicReader +import com.github.kevindagame.util.schematic.DataFolderSchematicReader import com.github.kevindagame.voxelsniper.Environment import com.github.kevindagame.voxelsniper.IVoxelsniper import com.github.kevindagame.voxelsniper.biome.VoxelBiome @@ -53,7 +53,7 @@ class VoxelSniperFabric : ModInitializer, IVoxelsniper { fileHandler = FabricFileHandler() - SchematicReader.initialize() + DataFolderSchematicReader.Companion.initialize() Messages.load(this) voxelSniperConfiguration = VoxelSniperConfiguration(this) diff --git a/VoxelSniperForge/src/main/java/com/github/kevindagame/voxelsniperforge/VoxelSniperForge.java b/VoxelSniperForge/src/main/java/com/github/kevindagame/voxelsniperforge/VoxelSniperForge.java index 6b8bbb3e..e471905e 100644 --- a/VoxelSniperForge/src/main/java/com/github/kevindagame/voxelsniperforge/VoxelSniperForge.java +++ b/VoxelSniperForge/src/main/java/com/github/kevindagame/voxelsniperforge/VoxelSniperForge.java @@ -4,7 +4,7 @@ import com.github.kevindagame.VoxelSniper; import com.github.kevindagame.command.VoxelCommandManager; import com.github.kevindagame.util.Messages; -import com.github.kevindagame.util.schematic.SchematicReader; +import com.github.kevindagame.util.schematic.DataFolderSchematicReader; import com.github.kevindagame.voxelsniper.Environment; import com.github.kevindagame.voxelsniper.IVoxelsniper; import com.github.kevindagame.voxelsniper.biome.VoxelBiome; @@ -107,11 +107,10 @@ public final void registerPermissionNodes(final PermissionGatherEvent.Nodes even ForgePermissionManager.register(event); } - // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(ServerStartingEvent event) { this.fileHandler = new ForgeFileHandler(this); - SchematicReader.initialize(); + DataFolderSchematicReader.Companion.initialize(); Messages.load(this); voxelSniperConfiguration = new VoxelSniperConfiguration(this); diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotVoxelSniper.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotVoxelSniper.java index 5d4f7fba..69ddcb79 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotVoxelSniper.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotVoxelSniper.java @@ -4,7 +4,7 @@ import com.github.kevindagame.VoxelSniper; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VersionChecker; -import com.github.kevindagame.util.schematic.SchematicReader; +import com.github.kevindagame.util.schematic.DataFolderSchematicReader; import com.github.kevindagame.voxelsniper.biome.VoxelBiome; import com.github.kevindagame.voxelsniper.entity.entitytype.VoxelEntityType; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; @@ -97,7 +97,7 @@ public void onEnable() { new BrushUsersCounter().registerListeners(); // Initialize commands - SchematicReader.initialize(); + DataFolderSchematicReader.Companion.initialize(); SpigotCommandManager.initialize(); // Initialize metrics diff --git a/gradle.properties b/gradle.properties index 01aa13fb..3ffc677e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -voxelsniper.version=8.12.5 +voxelsniper.version=8.13.0 org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false