mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-08-05 20:13:03 +00:00
Add strictOrdering parameter to setting isDefault check
This commit is contained in:
parent
63ccc28c8e
commit
5f6ee80f1c
1 changed files with 12 additions and 3 deletions
|
@ -273,7 +273,7 @@ public class ConfigurationManager extends Manager {
|
||||||
this.configuration.save();
|
this.configuration.save();
|
||||||
|
|
||||||
// Legacy nag: WorldGuard Regions
|
// Legacy nag: WorldGuard Regions
|
||||||
if (!isDefault(Setting.WORLDGUARD_ALLOWED_REGIONS) || !isDefault(Setting.WORLDGUARD_DISALLOWED_REGIONS)) {
|
if (!isDefault(Setting.WORLDGUARD_ALLOWED_REGIONS, false) || !isDefault(Setting.WORLDGUARD_DISALLOWED_REGIONS, false)) {
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
"It looks like you're using the 'allowed-regions' or 'disallowed-regions' settings.",
|
"It looks like you're using the 'allowed-regions' or 'disallowed-regions' settings.",
|
||||||
"These settings are deprecated from PlayerParticles, and will be removed in a future update.",
|
"These settings are deprecated from PlayerParticles, and will be removed in a future update.",
|
||||||
|
@ -282,8 +282,17 @@ public class ConfigurationManager extends Manager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDefault(Setting setting) {
|
/**
|
||||||
|
* Checks if a setting is the default value.
|
||||||
|
*
|
||||||
|
* @param setting The setting to check.
|
||||||
|
* @param strictOrdering If true, compares lists with strict ordering.
|
||||||
|
* @return True if the setting is default.
|
||||||
|
*/
|
||||||
|
private boolean isDefault(Setting setting, boolean strictOrdering) {
|
||||||
if (setting.defaultValue instanceof List) {
|
if (setting.defaultValue instanceof List) {
|
||||||
|
if (strictOrdering) return setting.defaultValue.equals(setting.value);
|
||||||
|
|
||||||
HashSet<String> currentSet = new HashSet<>(setting.getStringList());
|
HashSet<String> currentSet = new HashSet<>(setting.getStringList());
|
||||||
Set<String> defaultSet = ((List<?>) setting.defaultValue).stream()
|
Set<String> defaultSet = ((List<?>) setting.defaultValue).stream()
|
||||||
.map(Object::toString)
|
.map(Object::toString)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue