diff --git a/ci-pom.xml b/ci-pom.xml index 9b39f06d..ed4ecf79 100644 --- a/ci-pom.xml +++ b/ci-pom.xml @@ -7,7 +7,7 @@ us.mytheria BlobLib - 1.692.0 + 1.693.0 pom.xml bloblib @@ -19,7 +19,7 @@ UTF-8 - ${name}-${parent.version} + ${project.name}-${project.parent.version} org.apache.maven.plugins diff --git a/local-pom.xml b/local-pom.xml index 2fc296f3..51140d9b 100644 --- a/local-pom.xml +++ b/local-pom.xml @@ -5,7 +5,7 @@ us.mytheria BlobLib - 1.692.0 + 1.693.0 pom.xml bloblib @@ -20,7 +20,7 @@ UTF-8 - ${name}-${parent.version} + ${project.name}-${project.parent.version} org.apache.maven.plugins @@ -108,11 +108,11 @@ ${project.groupId} ${project.artifactId} - ${project.version} + ${project.parent.version} jar true ${testServer}/plugins/ - ${build.finalName}.jar + ${project.build.finalName}.jar diff --git a/pom.xml b/pom.xml index b0e1fb47..2ddee54d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 us.mytheria BlobLib - 1.692.0 + 1.693.0 pom diff --git a/src/main/java/us/mytheria/bloblib/managers/ManagerDirector.java b/src/main/java/us/mytheria/bloblib/managers/ManagerDirector.java index 8e5fd394..82c8661a 100644 --- a/src/main/java/us/mytheria/bloblib/managers/ManagerDirector.java +++ b/src/main/java/us/mytheria/bloblib/managers/ManagerDirector.java @@ -426,6 +426,35 @@ public BlobPlugin getPlugin() { return plugin; } + /** + * Will detach an embedded file/asset from the plugin jar to + * the corresponding directory + * + * @param fileName The name of the file to detach + * @param debug Whether to print debug messages + * @param path The path to the directory + * @return The ManagerDirector instance for method chaining + */ + public ManagerDirector detachAsset(String fileName, boolean debug, File path) { + Logger logger = getPlugin().getAnjoLogger(); + File file = new File(path + "/" + fileName + ".yml"); + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + if (debug) + logger.debug(" asset " + fileName + ".yml was not detached"); + e.printStackTrace(); + return this; + } + } + ResourceUtil.updateYml(path, "/temp" + fileName + ".yml", fileName + ".yml", file, plugin); + boolean successful = MessageManager.loadAndRegisterYamlConfiguration(file, plugin); + if (debug && successful) + logger.debug(" asset " + fileName + ".yml successfully detached"); + return this; + } + /** * Will detach an embedded BlobMessage file/asset from the plugin jar to * the corresponding directory in the plugin data folder.