|
@@ -1,6 +1,7 @@
|
|
|
package com.gmail.nossr50.util.sounds;
|
|
|
|
|
|
-import com.gmail.nossr50.config.SoundConfig;
|
|
|
+import com.gmail.nossr50.config.hocon.sound.SoundSetting;
|
|
|
+import com.gmail.nossr50.mcMMO;
|
|
|
import com.gmail.nossr50.util.Misc;
|
|
|
import org.bukkit.Location;
|
|
|
import org.bukkit.Sound;
|
|
@@ -15,24 +16,24 @@ public class SoundManager {
|
|
|
* @param soundType the type of sound
|
|
|
*/
|
|
|
public static void sendSound(Player player, Location location, SoundType soundType) {
|
|
|
- if (SoundConfig.getInstance().getIsEnabled(soundType))
|
|
|
+ if (mcMMO.getConfigManager().getConfigSound().isSoundEnabled(soundType))
|
|
|
player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(soundType));
|
|
|
}
|
|
|
|
|
|
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory) {
|
|
|
- if (SoundConfig.getInstance().getIsEnabled(soundType))
|
|
|
+ if (mcMMO.getConfigManager().getConfigSound().isSoundEnabled(soundType))
|
|
|
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), getPitch(soundType));
|
|
|
}
|
|
|
|
|
|
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory, float pitchModifier) {
|
|
|
float totalPitch = Math.min(2.0F, (getPitch(soundType) + pitchModifier));
|
|
|
|
|
|
- if (SoundConfig.getInstance().getIsEnabled(soundType))
|
|
|
+ if (mcMMO.getConfigManager().getConfigSound().isSoundEnabled(soundType))
|
|
|
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch);
|
|
|
}
|
|
|
|
|
|
public static void worldSendSound(World world, Location location, SoundType soundType) {
|
|
|
- if (SoundConfig.getInstance().getIsEnabled(soundType))
|
|
|
+ if (mcMMO.getConfigManager().getConfigSound().isSoundEnabled(soundType))
|
|
|
world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
|
|
|
}
|
|
|
|
|
@@ -43,7 +44,8 @@ public class SoundManager {
|
|
|
* @return the volume for this soundtype
|
|
|
*/
|
|
|
private static float getVolume(SoundType soundType) {
|
|
|
- return SoundConfig.getInstance().getVolume(soundType) * SoundConfig.getInstance().getMasterVolume();
|
|
|
+ SoundSetting soundSetting = mcMMO.getConfigManager().getConfigSound().getSoundSetting(soundType);
|
|
|
+ return soundSetting.getVolume() * (float) mcMMO.getConfigManager().getConfigSound().getMasterVolume();
|
|
|
}
|
|
|
|
|
|
private static float getPitch(SoundType soundType) {
|
|
@@ -51,8 +53,10 @@ public class SoundManager {
|
|
|
return getFizzPitch();
|
|
|
else if (soundType == SoundType.POP)
|
|
|
return getPopPitch();
|
|
|
- else
|
|
|
- return SoundConfig.getInstance().getPitch(soundType);
|
|
|
+ else {
|
|
|
+ SoundSetting soundSetting = mcMMO.getConfigManager().getConfigSound().getSoundSetting(soundType);
|
|
|
+ return soundSetting.getPitch();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private static Sound getSound(SoundType soundType) {
|