Config validation rewrite part 1

This commit is contained in:
nossr50
2022-01-30 15:31:52 -08:00
parent 86e7bfbf89
commit 16e90da8fd
16 changed files with 293 additions and 263 deletions

View File

@@ -8,7 +8,6 @@ public class SoundConfig extends BukkitConfig {
public SoundConfig() {
super("sounds.yml");
validate();
instance = this;
}
@@ -25,22 +24,24 @@ public class SoundConfig extends BukkitConfig {
}
@Override
protected boolean validateKeys() {
protected void validateConfigKeys() {
//TODO: Rewrite legacy validation code
for (SoundType soundType : SoundType.values()) {
if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) {
mcMMO.p.getLogger().info("[mcMMO] Sound volume cannot be below 0 for " + soundType);
return false;
//TODO: Rewrite legacy validation code
//return false;
}
//Sounds with custom pitching don't use pitch values
if (!soundType.usesCustomPitch()) {
if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) {
mcMMO.p.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for " + soundType);
return false;
//TODO: Rewrite legacy validation code
//return false;
}
}
}
return true;
}
public float getMasterVolume() {