Pārlūkot izejas kodu

Master volume config option

t00thpick1 9 gadi atpakaļ
vecāks
revīzija
272e99d41f

+ 2 - 0
src/main/java/com/gmail/nossr50/config/Config.java

@@ -533,4 +533,6 @@ public class Config extends AutoUpdateConfigLoader {
     /* PVP & PVE Settings */
     public boolean getPVPEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); }
     public boolean getPVEEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); }
+
+    public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); }
 }

+ 7 - 6
src/main/java/com/gmail/nossr50/util/Misc.java

@@ -13,6 +13,7 @@ import org.bukkit.entity.Player;
 import org.bukkit.inventory.ItemStack;
 
 import com.gmail.nossr50.mcMMO;
+import com.gmail.nossr50.config.Config;
 import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
 import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
 import com.gmail.nossr50.util.player.UserManager;
@@ -30,14 +31,14 @@ public final class Misc {
 
     // Sound Pitches & Volumes from CB
     public static final float ANVIL_USE_PITCH  = 0.3F;  // Not in CB directly, I went off the place sound values
-    public static final float ANVIL_USE_VOLUME = 1.0F;  // Not in CB directly, I went off the place sound values
-    public static final float FIZZ_VOLUME      = 0.5F;
-    public static final float POP_VOLUME       = 0.2F;
-    public static final float BAT_VOLUME       = 1.0F;
+    public static final float ANVIL_USE_VOLUME = 1.0F * Config.getInstance().getMasterVolume();  // Not in CB directly, I went off the place sound values
+    public static final float FIZZ_VOLUME      = 0.5F * Config.getInstance().getMasterVolume();
+    public static final float POP_VOLUME       = 0.2F * Config.getInstance().getMasterVolume();
+    public static final float BAT_VOLUME       = 1.0F * Config.getInstance().getMasterVolume();
     public static final float BAT_PITCH        = 0.6F;
-    public static final float GHAST_VOLUME     = 1.0F;
+    public static final float GHAST_VOLUME     = 1.0F * Config.getInstance().getMasterVolume();
     public static final float LEVELUP_PITCH    = 0.5F;  // Reduced to differentiate between vanilla level-up
-    public static final float LEVELUP_VOLUME   = 0.75F; // Use max volume always
+    public static final float LEVELUP_VOLUME   = 0.75F * Config.getInstance().getMasterVolume(); // Use max volume always
 
     public static final Set<String> modNames = ImmutableSet.of("LOTR", "BUILDCRAFT", "ENDERIO", "ENHANCEDBIOMES", "IC2", "METALLURGY", "FORESTRY", "GALACTICRAFT", "RAILCRAFT", "TWILIGHTFOREST", "THAUMCRAFT", "GRAVESTONEMOD", "GROWTHCRAFT", "ARCTICMOBS", "DEMONMOBS", "INFERNOMOBS", "SWAMPMOBS", "MARICULTURE", "MINESTRAPPOLATION");
 

+ 7 - 0
src/main/resources/config.yml

@@ -502,3 +502,10 @@ Particles:
     # this will happen by default for every 100 levels.
     LevelUp_Enabled: true
     LevelUp_Tier: 100
+#
+#  Settings for sounds
+###
+Sounds:
+    # This setting controls the master volume. 1.0 is Max,  0 would be off
+    MasterVolume: 1.0
+