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";
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)
{
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));
}
/**