You can now turn off sound effects used by mcMMO

This commit is contained in:
nossr50 2019-01-21 05:23:48 -08:00
parent 11461cc220
commit b42b4cadbe
3 changed files with 29 additions and 4 deletions

View File

@ -61,4 +61,10 @@ public class SoundConfig extends AutoUpdateConfigLoader {
String key = "Sounds."+soundType.toString()+".Pitch"; String key = "Sounds."+soundType.toString()+".Pitch";
return (float) config.getDouble(key); return (float) config.getDouble(key);
} }
public boolean getIsEnabled(SoundType soundType)
{
String key = "Sounds."+soundType.toString()+".Enabled";
return config.getBoolean(key, true);
}
} }

View File

@ -15,23 +15,28 @@ public class SoundManager {
*/ */
public static void sendSound(Player player, Location location, SoundType soundType) 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) 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) public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory, float pitchModifier)
{ {
float totalPitch = Math.min(2.0F, (getPitch(soundType) + 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) 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));
} }
/** /**

View File

@ -5,44 +5,58 @@ Sounds:
# 0.0 = No Volume # 0.0 = No Volume
MasterVolume: 1.0 MasterVolume: 1.0
ANVIL: ANVIL:
Enable: true
Volume: 1.0 Volume: 1.0
Pitch: 0.3 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, Pop, and Kraken make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard
FIZZ: FIZZ:
Enable: true
Volume: 0.5 Volume: 0.5
LEVEL_UP: LEVEL_UP:
Enable: true
Volume: 0.75 Volume: 0.75
Pitch: 0.5 Pitch: 0.5
ITEM_BREAK: ITEM_BREAK:
Enable: true
Volume: 1.0 Volume: 1.0
Pitch: 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 #Fizz, Pop, and Kraken make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard
POP: POP:
Enable: true
Volume: 0.2 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 #Fizz, Pop, and Kraken make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard
KRAKEN: KRAKEN:
Enable: true
Volume: 1.0 Volume: 1.0
CHIMAERA_WING: CHIMAERA_WING:
Enable: true
Volume: 1.0 Volume: 1.0
Pitch: 0.6 Pitch: 0.6
ROLL_ACTIVATED: ROLL_ACTIVATED:
Enable: true
Volume: 1.0 Volume: 1.0
Pitch: 0.7 Pitch: 0.7
SKILL_UNLOCKED: SKILL_UNLOCKED:
Enable: true
Volume: 1.0 Volume: 1.0
Pitch: 1.4 Pitch: 1.4
DEFLECT_ARROWS: DEFLECT_ARROWS:
Enable: true
Volume: 1.0 Volume: 1.0
Pitch: 2.0 Pitch: 2.0
TOOL_READY: TOOL_READY:
Enable: true
Volume: 1.0 Volume: 1.0
Pitch: 0.4 Pitch: 0.4
ABILITY_ACTIVATED_GENERIC: ABILITY_ACTIVATED_GENERIC:
Enable: true
Volume: 1.0 Volume: 1.0
Pitch: 0.1 Pitch: 0.1
ABILITY_ACTIVATED_BERSERK: ABILITY_ACTIVATED_BERSERK:
Enable: true
Volume: 0.5 Volume: 0.5
Pitch: 1.7 Pitch: 1.7
TIRED: TIRED:
Enable: true
Volume: 1.0 Volume: 1.0
Pitch: 1.7 Pitch: 1.7