diff --git a/src/main/java/com/gmail/nossr50/config/SoundConfig.java b/src/main/java/com/gmail/nossr50/config/SoundConfig.java index c7ef4b861..1bd215461 100644 --- a/src/main/java/com/gmail/nossr50/config/SoundConfig.java +++ b/src/main/java/com/gmail/nossr50/config/SoundConfig.java @@ -61,4 +61,10 @@ public class SoundConfig extends AutoUpdateConfigLoader { String key = "Sounds."+soundType.toString()+".Pitch"; return (float) config.getDouble(key); } + + public boolean getIsEnabled(SoundType soundType) + { + String key = "Sounds."+soundType.toString()+".Enabled"; + return config.getBoolean(key, true); + } } diff --git a/src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java b/src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java index d6c8bd4d5..5a49d55b4 100644 --- a/src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java +++ b/src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java @@ -15,23 +15,28 @@ public class SoundManager { */ public static void sendSound(Player player, Location location, SoundType soundType) { - player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(soundType)); + if(SoundConfig.getInstance().getIsEnabled(soundType)) + player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(soundType)); } public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory) { - player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), getPitch(soundType)); + if(SoundConfig.getInstance().getIsEnabled(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)); - player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch); + + if(SoundConfig.getInstance().getIsEnabled(soundType)) + player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch); } public static void worldSendSound(World world, Location location, SoundType soundType) { - world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType)); + if(SoundConfig.getInstance().getIsEnabled(soundType)) + world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType)); } /** diff --git a/src/main/resources/sounds.yml b/src/main/resources/sounds.yml index f18c53146..21f3e48d2 100644 --- a/src/main/resources/sounds.yml +++ b/src/main/resources/sounds.yml @@ -5,44 +5,58 @@ Sounds: # 0.0 = No Volume MasterVolume: 1.0 ANVIL: + Enable: true Volume: 1.0 Pitch: 0.3 #Fizz, Pop, and Kraken make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard FIZZ: + Enable: true Volume: 0.5 LEVEL_UP: + Enable: true Volume: 0.75 Pitch: 0.5 ITEM_BREAK: + Enable: true Volume: 1.0 Pitch: 1.0 #Fizz, Pop, and Kraken make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard POP: + Enable: true Volume: 0.2 #Fizz, Pop, and Kraken make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard KRAKEN: + Enable: true Volume: 1.0 CHIMAERA_WING: + Enable: true Volume: 1.0 Pitch: 0.6 ROLL_ACTIVATED: + Enable: true Volume: 1.0 Pitch: 0.7 SKILL_UNLOCKED: + Enable: true Volume: 1.0 Pitch: 1.4 DEFLECT_ARROWS: + Enable: true Volume: 1.0 Pitch: 2.0 TOOL_READY: + Enable: true Volume: 1.0 Pitch: 0.4 ABILITY_ACTIVATED_GENERIC: + Enable: true Volume: 1.0 Pitch: 0.1 ABILITY_ACTIVATED_BERSERK: + Enable: true Volume: 0.5 Pitch: 1.7 TIRED: + Enable: true Volume: 1.0 Pitch: 1.7 \ No newline at end of file