diff --git a/src/main/java/net/knarcraft/knarlib/config/StargateYamlConfiguration.java b/src/main/java/net/knarcraft/knarlib/config/StargateYamlConfiguration.java index 122e2b8..0270eed 100644 --- a/src/main/java/net/knarcraft/knarlib/config/StargateYamlConfiguration.java +++ b/src/main/java/net/knarcraft/knarlib/config/StargateYamlConfiguration.java @@ -81,6 +81,16 @@ public class StargateYamlConfiguration extends YamlConfiguration { } } + /** + * Checks whether the given configuration key is a comment + * + * @param key

The configuration key to check

+ * @return

True if the configuration key is a comment

+ */ + public static boolean isComment(@NotNull String key) { + return key.matches(".*" + START_OF_COMMENT + "[0-9]+"); + } + /** * Saves the given configuration * @@ -107,7 +117,7 @@ public class StargateYamlConfiguration extends YamlConfiguration { */ public static Set getKeysWithoutComments(@NotNull ConfigurationSection configurationSection, boolean deep) { Set keys = new HashSet<>(configurationSection.getKeys(deep)); - keys.removeIf(key -> key.matches(START_OF_COMMENT + "[0-9]+")); + keys.removeIf(StargateYamlConfiguration::isComment); return keys; }