Fixes a bug when checking if a config key is a comment
All checks were successful
KnarCraft/KnarLib/pipeline/head This commit looks good
All checks were successful
KnarCraft/KnarLib/pipeline/head This commit looks good
This commit is contained in:
@@ -81,6 +81,16 @@ public class StargateYamlConfiguration extends YamlConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given configuration key is a comment
|
||||
*
|
||||
* @param key <p>The configuration key to check</p>
|
||||
* @return <p>True if the configuration key is a comment</p>
|
||||
*/
|
||||
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<String> getKeysWithoutComments(@NotNull ConfigurationSection configurationSection, boolean deep) {
|
||||
Set<String> keys = new HashSet<>(configurationSection.getKeys(deep));
|
||||
keys.removeIf(key -> key.matches(START_OF_COMMENT + "[0-9]+"));
|
||||
keys.removeIf(StargateYamlConfiguration::isComment);
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user