Browse Source

Merge pull request #1 from mcMMO-Dev/master

Merge master
Dor 9 years ago
parent
commit
2d3d11ec2d

+ 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); }
 }

+ 10 - 2
src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java

@@ -50,13 +50,21 @@ public class HerbalismManager extends SkillManager {
 
     public boolean canGreenThumbBlock(BlockState blockState) {
         Player player = getPlayer();
+        ItemStack item = player.getInventory().getItemInMainHand();
+        
+        if (item.getAmount() <= 0)
+            return false;
 
-        return player.getItemInHand().getType() == Material.SEEDS && BlockUtils.canMakeMossy(blockState) && Permissions.greenThumbBlock(player, blockState.getType());
+        return item.getType() == Material.SEEDS && BlockUtils.canMakeMossy(blockState) && Permissions.greenThumbBlock(player, blockState.getType());
     }
 
     public boolean canUseShroomThumb(BlockState blockState) {
         Player player = getPlayer();
-        Material itemType = player.getItemInHand().getType();
+        ItemStack item = player.getInventory().getItemInMainHand();
+        Material itemType = item.getType();
+        
+        if (item.getAmount() <= 0)
+            return false;
 
         return (itemType == Material.RED_MUSHROOM || itemType == Material.BROWN_MUSHROOM) && BlockUtils.canMakeShroomy(blockState) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
     }

+ 7 - 0
src/main/java/com/gmail/nossr50/util/BlockUtils.java

@@ -47,6 +47,11 @@ public final class BlockUtils {
             case ENCHANTMENT_TABLE:
             case ENDER_CHEST:
             case FENCE_GATE:
+            case ACACIA_FENCE_GATE:
+            case DARK_OAK_FENCE_GATE:
+            case SPRUCE_FENCE_GATE:
+            case BIRCH_FENCE_GATE:
+            case JUNGLE_FENCE_GATE:
             case FURNACE:
             case IRON_DOOR_BLOCK:
             case JUKEBOX:
@@ -70,10 +75,12 @@ public final class BlockUtils {
             case BIRCH_DOOR:
             case JUNGLE_DOOR:
             case DARK_OAK_DOOR:
+            case FENCE:
             case ACACIA_FENCE:
             case DARK_OAK_FENCE:
             case BIRCH_FENCE:
             case JUNGLE_FENCE:
+            case SPRUCE_FENCE:
             case ARMOR_STAND:
                 return false;
 

+ 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
+