mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 00:30:07 +01:00
Convert soundconfig to new system
This commit is contained in:
parent
6152ac30b9
commit
bd74d6e4f1
@ -7,6 +7,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SoundConfig extends ConfigValidated {
|
public class SoundConfig extends ConfigValidated {
|
||||||
|
public static final String SOUNDS = "Sounds";
|
||||||
|
public static final String VOLUME = "Volume";
|
||||||
|
public static final String PITCH = "Pitch";
|
||||||
|
public static final String ENABLED = "Enabled";
|
||||||
|
public static final String MASTER_VOLUME = "MasterVolume";
|
||||||
//private static SoundConfig instance;
|
//private static SoundConfig instance;
|
||||||
|
|
||||||
public SoundConfig() {
|
public SoundConfig() {
|
||||||
@ -46,13 +51,13 @@ public class SoundConfig extends ConfigValidated {
|
|||||||
ArrayList<String> reasons = new ArrayList<>();
|
ArrayList<String> reasons = new ArrayList<>();
|
||||||
|
|
||||||
for (SoundType soundType : SoundType.values()) {
|
for (SoundType soundType : SoundType.values()) {
|
||||||
if (getDoubleValue("Sounds." + soundType.toString() + ".Volume") < 0) {
|
if (getDoubleValue(SOUNDS, soundType.toString(), VOLUME) < 0) {
|
||||||
reasons.add("[mcMMO] Sound volume cannot be below 0 for " + soundType.toString());
|
reasons.add("[mcMMO] Sound volume cannot be below 0 for " + soundType.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sounds with custom pitching don't use pitch values
|
//Sounds with custom pitching don't use pitch values
|
||||||
if (!soundType.usesCustomPitch()) {
|
if (!soundType.usesCustomPitch()) {
|
||||||
if (getDoubleValue("Sounds." + soundType.toString() + ".Pitch") < 0) {
|
if (getDoubleValue(SOUNDS, soundType.toString(), PITCH) < 0) {
|
||||||
reasons.add("[mcMMO] Sound pitch cannot be below 0 for " + soundType.toString());
|
reasons.add("[mcMMO] Sound pitch cannot be below 0 for " + soundType.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,21 +67,18 @@ public class SoundConfig extends ConfigValidated {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getMasterVolume() {
|
public float getMasterVolume() {
|
||||||
return (float) getDoubleValue("Sounds.MasterVolume");
|
return (float) getDoubleValue(SOUNDS, MASTER_VOLUME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getVolume(SoundType soundType) {
|
public float getVolume(SoundType soundType) {
|
||||||
String key = "Sounds." + soundType.toString() + ".Volume";
|
return (float) getDoubleValue(SOUNDS, soundType.toString(), VOLUME);
|
||||||
return (float) getDoubleValue(key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getPitch(SoundType soundType) {
|
public float getPitch(SoundType soundType) {
|
||||||
String key = "Sounds." + soundType.toString() + ".Pitch";
|
return (float) getDoubleValue(SOUNDS, soundType.toString(), PITCH);
|
||||||
return (float) getDoubleValue(key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getIsEnabled(SoundType soundType) {
|
public boolean getIsEnabled(SoundType soundType) {
|
||||||
String key = "Sounds." + soundType.toString() + ".Enabled";
|
return getBooleanValue(SOUNDS, soundType.toString(), ENABLED);
|
||||||
return getBooleanValue(key, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user