瀏覽代碼

Added options to disable various sound effects.

Fixes #1577
GJ 11 年之前
父節點
當前提交
41da32cd1b

+ 1 - 0
Changelog.txt

@@ -9,6 +9,7 @@ Key:
 
 
 Version 1.4.08-dev
 Version 1.4.08-dev
  + Added the possibility to gain experience when using Fishing "Shake"
  + Added the possibility to gain experience when using Fishing "Shake"
+ + Added config options to disable various sound effects
  = Fixed bug with toggle commands not properly displaying the success message.
  = Fixed bug with toggle commands not properly displaying the success message.
  = Fixed IllegalArgumentException caused by an empty Fishing treasure category
  = Fixed IllegalArgumentException caused by an empty Fishing treasure category
 
 

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

@@ -219,6 +219,8 @@ public class Config extends AutoUpdateConfigLoader {
 
 
     public boolean getMatchOfflinePlayers() { return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false); }
     public boolean getMatchOfflinePlayers() { return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false); }
 
 
+    public boolean getLevelUpSoundsEnabled() { return config.getBoolean("General.LevelUp_Sounds", true); }
+
     /* Mob Healthbar */
     /* Mob Healthbar */
     public MobHealthbarType getMobHealthbarDefault() {
     public MobHealthbarType getMobHealthbarDefault() {
         try {
         try {
@@ -316,6 +318,7 @@ public class Config extends AutoUpdateConfigLoader {
     public int getChimaeraCooldown() { return config.getInt("Items.Chimaera_Wing.Cooldown", 240); }
     public int getChimaeraCooldown() { return config.getInt("Items.Chimaera_Wing.Cooldown", 240); }
     public int getChimaeraWarmup() { return config.getInt("Items.Chimaera_Wing.Warmup", 5); }
     public int getChimaeraWarmup() { return config.getInt("Items.Chimaera_Wing.Warmup", 5); }
     public int getChimaeraRecentlyHurtCooldown() { return config.getInt("Items.Chimaera_Wing.RecentlyHurt_Cooldown", 60); }
     public int getChimaeraRecentlyHurtCooldown() { return config.getInt("Items.Chimaera_Wing.RecentlyHurt_Cooldown", 60); }
+    public boolean getChimaeraSoundEnabled() { return config.getBoolean("Items.Chimaera_Wing.Sound_Enabled", true); }
 
 
     /* Particles */
     /* Particles */
     public boolean getAbilityActivationEffectEnabled() { return config.getBoolean("Particles.Ability_Activation", true); }
     public boolean getAbilityActivationEffectEnabled() { return config.getBoolean("Particles.Ability_Activation", true); }
@@ -399,6 +402,8 @@ public class Config extends AutoUpdateConfigLoader {
 
 
     /* Repair */
     /* Repair */
     public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
     public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
+    public boolean getRepairAnvilPlaceSoundsEnabled() { return config.getBoolean("Skills.Repair.Anvil_Placed_Sounds", true); }
+    public boolean getRepairAnvilUseSoundsEnabled() { return config.getBoolean("Skills.Repair.Anvil_Use_Sounds", true); }
     public Material getRepairAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Anvil_Material", "IRON_BLOCK")); }
     public Material getRepairAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Anvil_Material", "IRON_BLOCK")); }
     public Material getSalvageAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Salvage_Anvil_ID", "GOLD_BLOCK")); }
     public Material getSalvageAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Salvage_Anvil_ID", "GOLD_BLOCK")); }
     public boolean getSalvageTools() { return config.getBoolean("Skills.Repair.Salvage_tools", true); }
     public boolean getSalvageTools() { return config.getBoolean("Skills.Repair.Salvage_tools", true); }
@@ -420,6 +425,7 @@ public class Config extends AutoUpdateConfigLoader {
     public boolean getBirchDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Birch", true); }
     public boolean getBirchDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Birch", true); }
     public boolean getSpruceDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Spruce", true); }
     public boolean getSpruceDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Spruce", true); }
     public boolean getJungleDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Jungle", true); }
     public boolean getJungleDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Jungle", true); }
+    public boolean getTreeFellerSoundsEnabled() { return config.getBoolean("Skills.Woodcutting.Tree_Feller_Sounds", true); }
 
 
     /* AFK Leveling */
     /* AFK Leveling */
     public boolean getAcrobaticsPreventAFK() { return config.getBoolean("Skills.Acrobatics.Prevent_AFK_Leveling", true); }
     public boolean getAcrobaticsPreventAFK() { return config.getBoolean("Skills.Acrobatics.Prevent_AFK_Leveling", true); }

+ 4 - 1
src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java

@@ -561,7 +561,10 @@ public class McMMOPlayer {
             return;
             return;
         }
         }
 
 
-        player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
+        if (Config.getInstance().getLevelUpSoundsEnabled()) {
+            player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
+        }
+
         player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(skillType.toString()) + ".Skillup", levelsGained, getSkillLevel(skillType)));
         player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(skillType.toString()) + ".Skillup", levelsGained, getSkillLevel(skillType)));
     }
     }
 
 

+ 3 - 3
src/main/java/com/gmail/nossr50/listeners/BlockListener.java

@@ -21,6 +21,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
 import org.bukkit.inventory.ItemStack;
 import org.bukkit.inventory.ItemStack;
 
 
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.mcMMO;
+import com.gmail.nossr50.config.Config;
 import com.gmail.nossr50.config.HiddenConfig;
 import com.gmail.nossr50.config.HiddenConfig;
 import com.gmail.nossr50.datatypes.player.McMMOPlayer;
 import com.gmail.nossr50.datatypes.player.McMMOPlayer;
 import com.gmail.nossr50.datatypes.skills.AbilityType;
 import com.gmail.nossr50.datatypes.skills.AbilityType;
@@ -32,7 +33,6 @@ import com.gmail.nossr50.runnables.StickyPistonTrackerTask;
 import com.gmail.nossr50.skills.excavation.ExcavationManager;
 import com.gmail.nossr50.skills.excavation.ExcavationManager;
 import com.gmail.nossr50.skills.herbalism.HerbalismManager;
 import com.gmail.nossr50.skills.herbalism.HerbalismManager;
 import com.gmail.nossr50.skills.mining.MiningManager;
 import com.gmail.nossr50.skills.mining.MiningManager;
-import com.gmail.nossr50.skills.repair.Repair;
 import com.gmail.nossr50.skills.smelting.SmeltingManager;
 import com.gmail.nossr50.skills.smelting.SmeltingManager;
 import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
 import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
 import com.gmail.nossr50.util.BlockUtils;
 import com.gmail.nossr50.util.BlockUtils;
@@ -112,7 +112,7 @@ public class BlockListener implements Listener {
             mcMMO.getPlaceStore().setTrue(blockState);
             mcMMO.getPlaceStore().setTrue(blockState);
         }
         }
 
 
-        if (Repair.anvilMessagesEnabled && BlockUtils.isMcMMOAnvil(blockState)) {
+        if (BlockUtils.isMcMMOAnvil(blockState)) {
             UserManager.getPlayer(player).getRepairManager().placedAnvilCheck(blockState.getType());
             UserManager.getPlayer(player).getRepairManager().placedAnvilCheck(blockState.getType());
         }
         }
     }
     }
@@ -301,7 +301,7 @@ public class BlockListener implements Listener {
          *
          *
          * We don't need to check permissions here because they've already been checked for the ability to even activate.
          * We don't need to check permissions here because they've already been checked for the ability to even activate.
          */
          */
-        if (mcMMOPlayer.getAbilityMode(AbilityType.TREE_FELLER) && BlockUtils.isLog(blockState)) {
+        if (mcMMOPlayer.getAbilityMode(AbilityType.TREE_FELLER) && BlockUtils.isLog(blockState) && Config.getInstance().getTreeFellerSoundsEnabled()) {
             player.playSound(blockState.getLocation(), Sound.FIZZ, Misc.FIZZ_VOLUME, Misc.getFizzPitch());
             player.playSound(blockState.getLocation(), Sound.FIZZ, Misc.FIZZ_VOLUME, Misc.getFizzPitch());
         }
         }
     }
     }

+ 14 - 4
src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java

@@ -49,9 +49,14 @@ public class RepairManager extends SkillManager {
             return;
             return;
         }
         }
 
 
-        player.sendMessage(Repair.getAnvilMessage(anvilType));
+        if (Repair.anvilMessagesEnabled) {
+            player.sendMessage(Repair.getAnvilMessage(anvilType));
+        }
+
+        if (Config.getInstance().getRepairAnvilPlaceSoundsEnabled()) {
+            player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
+        }
 
 
-        player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
         togglePlacedAnvil(anvilType);
         togglePlacedAnvil(anvilType);
     }
     }
 
 
@@ -141,7 +146,9 @@ public class RepairManager extends SkillManager {
         applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) * repairable.getXpMultiplier()) * ExperienceConfig.getInstance().getRepairXPBase() * ExperienceConfig.getInstance().getRepairXP(repairable.getRepairMaterialType())));
         applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) * repairable.getXpMultiplier()) * ExperienceConfig.getInstance().getRepairXPBase() * ExperienceConfig.getInstance().getRepairXP(repairable.getRepairMaterialType())));
 
 
         // BWONG BWONG BWONG
         // BWONG BWONG BWONG
-        player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
+        if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
+            player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
+        }
 
 
         // Repair the item!
         // Repair the item!
         item.setDurability(newDurability);
         item.setDurability(newDurability);
@@ -165,7 +172,10 @@ public class RepairManager extends SkillManager {
 
 
             Misc.dropItems(location, new ItemStack(Repair.getRepairAndSalvageItem(item)), Repair.getRepairAndSalvageQuantities(item) * item.getAmount());
             Misc.dropItems(location, new ItemStack(Repair.getRepairAndSalvageItem(item)), Repair.getRepairAndSalvageQuantities(item) * item.getAmount());
 
 
-            player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
+            if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
+                player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
+            }
+
             player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess"));
             player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess"));
         }
         }
         else {
         else {

+ 6 - 1
src/main/java/com/gmail/nossr50/util/ChimaeraWing.java

@@ -134,10 +134,15 @@ public final class ChimaeraWing {
         player.updateInventory();
         player.updateInventory();
         mcMMOPlayer.actualizeChimeraWingLastUse();
         mcMMOPlayer.actualizeChimeraWingLastUse();
         mcMMOPlayer.setTeleportCommenceLocation(null);
         mcMMOPlayer.setTeleportCommenceLocation(null);
+
         if (Config.getInstance().getStatsTrackingEnabled()) {
         if (Config.getInstance().getStatsTrackingEnabled()) {
             MetricsManager.chimeraWingUsed();
             MetricsManager.chimeraWingUsed();
         }
         }
-        player.playSound(location, Sound.BAT_TAKEOFF, Misc.BAT_VOLUME, Misc.BAT_PITCH);
+
+        if (Config.getInstance().getChimaeraSoundEnabled()) {
+            player.playSound(location, Sound.BAT_TAKEOFF, Misc.BAT_VOLUME, Misc.BAT_PITCH);
+        }
+        
         player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
         player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
     }
     }
 
 

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

@@ -26,6 +26,8 @@ General:
     Verbose_Logging: false
     Verbose_Logging: false
     # Should mcMMO over-write configs to update, or make new ones ending in .new?
     # Should mcMMO over-write configs to update, or make new ones ending in .new?
     Config_Update_Overwrite: true
     Config_Update_Overwrite: true
+    # Play level-up sounds
+    LevelUp_Sounds: true
 
 
 #
 #
 #  Settings for the mcMMO scoreboards
 #  Settings for the mcMMO scoreboards
@@ -170,6 +172,7 @@ Items:
         Use_Cost: 1
         Use_Cost: 1
         Recipe_Cost: 5
         Recipe_Cost: 5
         Item_Name: FEATHER
         Item_Name: FEATHER
+        Sound_Enabled: true
 
 
 #
 #
 #  Settings for Parties
 #  Settings for Parties
@@ -257,6 +260,8 @@ Skills:
     Repair:
     Repair:
         Level_Cap: 0
         Level_Cap: 0
         Anvil_Messages: true
         Anvil_Messages: true
+        Anvil_Placed_Sounds: true
+        Anvil_Use_Sounds: true
         Anvil_Material: IRON_BLOCK
         Anvil_Material: IRON_BLOCK
         Salvage_Anvil_Material: GOLD_BLOCK
         Salvage_Anvil_Material: GOLD_BLOCK
         Salvage_tools: true
         Salvage_tools: true
@@ -291,6 +296,7 @@ Skills:
         Block_Cracker:
         Block_Cracker:
             SmoothBrick_To_CrackedBrick: true
             SmoothBrick_To_CrackedBrick: true
     Woodcutting:
     Woodcutting:
+        Tree_Feller_Sounds: true
         Level_Cap: 0
         Level_Cap: 0
 
 
 #
 #
@@ -386,4 +392,4 @@ Particles:
     # These settings determine if fireworks should get launched when a player levels-up,
     # These settings determine if fireworks should get launched when a player levels-up,
     # this will happen by default for every 100 levels.
     # this will happen by default for every 100 levels.
     LevelUp_Enabled: true
     LevelUp_Enabled: true
-    LevelUp_Tier: 100
+    LevelUp_Tier: 100