diff --git a/ci-pom.xml b/ci-pom.xml index 57f477d2..7c39d7c9 100644 --- a/ci-pom.xml +++ b/ci-pom.xml @@ -7,7 +7,7 @@ us.mytheria BlobLib - 1.697.20 + 1.697.21 pom.xml bloblib diff --git a/local-pom.xml b/local-pom.xml index 3dea5f21..84cf7baa 100644 --- a/local-pom.xml +++ b/local-pom.xml @@ -5,7 +5,7 @@ us.mytheria BlobLib - 1.697.20 + 1.697.21 pom.xml bloblib diff --git a/pom.xml b/pom.xml index 21cb7d9e..c298388e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 us.mytheria BlobLib - 1.697.20 + 1.697.21 pom diff --git a/src/main/java/us/mytheria/bloblib/managers/ManagerDirector.java b/src/main/java/us/mytheria/bloblib/managers/ManagerDirector.java index ccee718f..9bd8de4d 100644 --- a/src/main/java/us/mytheria/bloblib/managers/ManagerDirector.java +++ b/src/main/java/us/mytheria/bloblib/managers/ManagerDirector.java @@ -258,14 +258,23 @@ public void addListenerBlobSerializableManager(Stri * @param consumer The consumer that will consume the expansion */ public void instantiateBlobPHExpansion(String identifier, Consumer consumer) { - if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") == null) { - getPlugin().getAnjoLogger().log("PlaceholderAPI not found, not registering PlaceholderAPI expansion for " + getPlugin().getName()); + if (!isPlaceholderAPIEnabled()) { + getPlugin().getAnjoLogger().log("PlaceholderAPI not found, not instantiating PlaceholderAPI expansion for " + getPlugin().getName()); return; } BlobPHExpansion expansion = new BlobPHExpansion(getPlugin(), identifier); consumer.accept(expansion); } + /** + * Checks whether PlaceholderAPI is enabled. + * + * @return Whether PlaceholderAPI is enabled. + */ + public boolean isPlaceholderAPIEnabled() { + return Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null; + } + /** * Adds a wallet owner manager to the director. * diff --git a/src/main/java/us/mytheria/bloblib/utilities/ResourceUtil.java b/src/main/java/us/mytheria/bloblib/utilities/ResourceUtil.java index f9e6de18..fe405784 100644 --- a/src/main/java/us/mytheria/bloblib/utilities/ResourceUtil.java +++ b/src/main/java/us/mytheria/bloblib/utilities/ResourceUtil.java @@ -45,12 +45,15 @@ public static void writeNewValues(File existingFile, YamlConfiguration updateYam Set keys = updateYamlConfiguration.getConfigurationSection("").getKeys(true); keys.forEach(key -> { if (!updateYamlConfiguration.isConfigurationSection(key)) { - List comments = updateYamlConfiguration.getComments(key); - List inLine = updateYamlConfiguration.getInlineComments(key); - if (comments.size() > 0) - existingYamlConfig.setComments(key, comments); - if (inLine.size() > 0) - existingYamlConfig.setInlineComments(key, inLine); + try { + List comments = updateYamlConfiguration.getComments(key); + List inLine = updateYamlConfiguration.getInlineComments(key); + if (comments.size() > 0) + existingYamlConfig.setComments(key, comments); + if (inLine.size() > 0) + existingYamlConfig.setInlineComments(key, inLine); + } catch (NoSuchMethodError ignored) { + } // if it's not a section, it's a value if (existingYamlConfig.contains(key)) return; }