mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 10:14:43 +02:00
You can now turn off sound effects used by mcMMO
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user