Browse Source

Sounds volume and pitch are now configurable in the new sounds.yml file

nossr50 6 years ago
parent
commit
85fd0a79bc
22 changed files with 251 additions and 45 deletions
  1. 0 2
      src/main/java/com/gmail/nossr50/config/AdvancedConfig.java
  2. 1 1
      src/main/java/com/gmail/nossr50/config/Config.java
  3. 64 0
      src/main/java/com/gmail/nossr50/config/SoundConfig.java
  4. 1 2
      src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java
  5. 3 1
      src/main/java/com/gmail/nossr50/datatypes/party/Party.java
  6. 3 1
      src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java
  7. 5 3
      src/main/java/com/gmail/nossr50/listeners/BlockListener.java
  8. 4 2
      src/main/java/com/gmail/nossr50/listeners/PlayerListener.java
  9. 2 4
      src/main/java/com/gmail/nossr50/mcMMO.java
  10. 3 1
      src/main/java/com/gmail/nossr50/party/PartyManager.java
  11. 3 1
      src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java
  12. 4 2
      src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java
  13. 4 2
      src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java
  14. 5 2
      src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java
  15. 7 3
      src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java
  16. 3 2
      src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java
  17. 3 1
      src/main/java/com/gmail/nossr50/util/ChimaeraWing.java
  18. 3 1
      src/main/java/com/gmail/nossr50/util/HolidayManager.java
  19. 2 14
      src/main/java/com/gmail/nossr50/util/Misc.java
  20. 81 0
      src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java
  21. 23 0
      src/main/java/com/gmail/nossr50/util/sounds/SoundType.java
  22. 27 0
      src/main/resources/sounds.yml

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

@@ -676,8 +676,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
     @Override
     @Override
     protected void loadKeys() {}
     protected void loadKeys() {}
 
 
-
-
     /* GENERAL */
     /* GENERAL */
     public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); }
     public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); }
     public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
     public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }

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

@@ -573,5 +573,5 @@ public class Config extends AutoUpdateConfigLoader {
     public boolean getPVPEnabled(PrimarySkill skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); }
     public boolean getPVPEnabled(PrimarySkill skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); }
     public boolean getPVEEnabled(PrimarySkill skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); }
     public boolean getPVEEnabled(PrimarySkill skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); }
     
     
-    public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); }
+    //public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); }
 }
 }

+ 64 - 0
src/main/java/com/gmail/nossr50/config/SoundConfig.java

@@ -0,0 +1,64 @@
+package com.gmail.nossr50.config;
+
+import com.gmail.nossr50.util.sounds.SoundType;
+
+public class SoundConfig extends AutoUpdateConfigLoader {
+    private static SoundConfig instance;
+
+    public SoundConfig()
+    {
+        super("sounds.yml");
+        validate();
+        this.instance = this;
+    }
+
+    @Override
+    protected void loadKeys() {
+
+    }
+
+    public static SoundConfig getInstance()
+    {
+        if(instance == null)
+            return new SoundConfig();
+
+        return instance;
+    }
+
+    @Override
+    protected boolean validateKeys() {
+        for(SoundType soundType : SoundType.values())
+        {
+            if(config.getDouble("Sounds."+soundType.toString()+".Volume") < 0)
+            {
+                plugin.getLogger().info("[mcMMO] Sound volume cannot be below 0 for "+soundType.toString());
+                return false;
+            }
+
+            //Sounds with custom pitching don't use pitch values
+            if(!soundType.usesCustomPitch())
+            {
+                if(config.getDouble("Sounds."+soundType.toString()+".Pitch") < 0)
+                {
+                    plugin.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for "+soundType.toString());
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); }
+
+    public float getVolume(SoundType soundType)
+    {
+        String key = "Sounds."+soundType.toString()+".Volume";
+        return (float) config.getDouble(key);
+    }
+
+    public float getPitch(SoundType soundType)
+    {
+        String key = "Sounds."+soundType.toString()+".Pitch";
+        return (float) config.getDouble(key);
+    }
+}

+ 1 - 2
src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java

@@ -37,8 +37,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
                 + ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName();
                 + ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName();
 
 
         if(Config.getInstance().getMySQLSSL())
         if(Config.getInstance().getMySQLSSL())
-            connectionString = "jdbc:mysql://" + Config.getInstance().getMySQLServerName()
-                    + ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName() +
+            connectionString +=
                     "?verifyServerCertificate=false"+
                     "?verifyServerCertificate=false"+
                     "&useSSL=true"+
                     "&useSSL=true"+
                     "&requireSSL=true";
                     "&requireSSL=true";

+ 3 - 1
src/main/java/com/gmail/nossr50/datatypes/party/Party.java

@@ -8,6 +8,8 @@ import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.party.PartyManager;
 import com.gmail.nossr50.party.PartyManager;
 import com.gmail.nossr50.util.EventUtils;
 import com.gmail.nossr50.util.EventUtils;
 import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.Misc;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import org.bukkit.ChatColor;
 import org.bukkit.ChatColor;
 import org.bukkit.Sound;
 import org.bukkit.Sound;
 import org.bukkit.command.CommandSender;
 import org.bukkit.command.CommandSender;
@@ -239,7 +241,7 @@ public class Party {
                 leader.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, getLevel()));
                 leader.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, getLevel()));
 
 
                 if (Config.getInstance().getLevelUpSoundsEnabled()) {
                 if (Config.getInstance().getLevelUpSoundsEnabled()) {
-                    leader.playSound(leader.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
+                    SoundManager.sendSound(leader, leader.getLocation(), SoundType.LEVEL_UP);
                 }
                 }
             }
             }
             return;
             return;

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

@@ -45,6 +45,8 @@ import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
 import com.gmail.nossr50.util.skills.ParticleEffectUtils;
 import com.gmail.nossr50.util.skills.ParticleEffectUtils;
 import com.gmail.nossr50.util.skills.PerksUtils;
 import com.gmail.nossr50.util.skills.PerksUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import org.apache.commons.lang.Validate;
 import org.apache.commons.lang.Validate;
 import org.bukkit.GameMode;
 import org.bukkit.GameMode;
 import org.bukkit.Location;
 import org.bukkit.Location;
@@ -512,7 +514,7 @@ public class McMMOPlayer {
         }
         }
 
 
         if (Config.getInstance().getLevelUpSoundsEnabled()) {
         if (Config.getInstance().getLevelUpSoundsEnabled()) {
-            player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
+            SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
         }
         }
 
 
         InteractionManager.sendPlayerLevelUpNotification(UserManager.getPlayer(player), primarySkill, profile.getSkillLevel(primarySkill));
         InteractionManager.sendPlayerLevelUpNotification(UserManager.getPlayer(player), primarySkill, profile.getSkillLevel(primarySkill));

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

@@ -21,6 +21,8 @@ import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
 import com.gmail.nossr50.util.*;
 import com.gmail.nossr50.util.*;
 import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.skills.SkillUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import org.bukkit.*;
 import org.bukkit.*;
 import org.bukkit.block.Block;
 import org.bukkit.block.Block;
 import org.bukkit.block.BlockFace;
 import org.bukkit.block.BlockFace;
@@ -365,7 +367,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(SuperAbility.TREE_FELLER) && BlockUtils.isLog(blockState) && Config.getInstance().getTreeFellerSoundsEnabled()) {
         if (mcMMOPlayer.getAbilityMode(SuperAbility.TREE_FELLER) && BlockUtils.isLog(blockState) && Config.getInstance().getTreeFellerSoundsEnabled()) {
-            player.playSound(blockState.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, Misc.FIZZ_VOLUME, Misc.getFizzPitch());
+            SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ);
         }
         }
     }
     }
 
 
@@ -404,7 +406,7 @@ public class BlockListener implements Listener {
         else if (mcMMOPlayer.getAbilityMode(SuperAbility.BERSERK) && heldItem.getType() == Material.AIR) {
         else if (mcMMOPlayer.getAbilityMode(SuperAbility.BERSERK) && heldItem.getType() == Material.AIR) {
             if (SuperAbility.BERSERK.blockCheck(block.getState()) && EventUtils.simulateBlockBreak(block, player, true)) {
             if (SuperAbility.BERSERK.blockCheck(block.getState()) && EventUtils.simulateBlockBreak(block, player, true)) {
                 event.setInstaBreak(true);
                 event.setInstaBreak(true);
-                player.playSound(block.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
+                SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
             }
             }
             else if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
             else if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
                 if (mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
                 if (mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
@@ -414,7 +416,7 @@ public class BlockListener implements Listener {
         }
         }
         else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && BlockUtils.isLeaves(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
         else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && BlockUtils.isLeaves(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
             event.setInstaBreak(true);
             event.setInstaBreak(true);
-            player.playSound(blockState.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
+            SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
         }
         }
     }
     }
 }
 }

+ 4 - 2
src/main/java/com/gmail/nossr50/listeners/PlayerListener.java

@@ -26,6 +26,8 @@ import com.gmail.nossr50.skills.unarmed.Unarmed;
 import com.gmail.nossr50.util.*;
 import com.gmail.nossr50.util.*;
 import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.skills.SkillUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import org.bukkit.GameMode;
 import org.bukkit.GameMode;
 import org.bukkit.Material;
 import org.bukkit.Material;
 import org.bukkit.Sound;
 import org.bukkit.Sound;
@@ -303,7 +305,7 @@ public class PlayerListener implements Listener {
             event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer));
             event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer));
 
 
             if (event.isCancelled()) {
             if (event.isCancelled()) {
-                player.playSound(player.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
+                SoundManager.sendSound(player, player.getLocation(), SoundType.POP);
                 return;
                 return;
             }
             }
         }
         }
@@ -314,7 +316,7 @@ public class PlayerListener implements Listener {
             event.setCancelled(cancel);
             event.setCancelled(cancel);
 
 
             if (pickupSuccess) {
             if (pickupSuccess) {
-                player.playSound(player.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
+                SoundManager.sendSound(player, player.getLocation(), SoundType.POP);
                 player.updateInventory();
                 player.updateInventory();
                 return;
                 return;
             }
             }

+ 2 - 4
src/main/java/com/gmail/nossr50/mcMMO.java

@@ -1,9 +1,6 @@
 package com.gmail.nossr50;
 package com.gmail.nossr50;
 
 
-import com.gmail.nossr50.config.AdvancedConfig;
-import com.gmail.nossr50.config.Config;
-import com.gmail.nossr50.config.CoreSkillsConfig;
-import com.gmail.nossr50.config.HiddenConfig;
+import com.gmail.nossr50.config.*;
 import com.gmail.nossr50.config.experience.ExperienceConfig;
 import com.gmail.nossr50.config.experience.ExperienceConfig;
 import com.gmail.nossr50.config.mods.ArmorConfigManager;
 import com.gmail.nossr50.config.mods.ArmorConfigManager;
 import com.gmail.nossr50.config.mods.BlockConfigManager;
 import com.gmail.nossr50.config.mods.BlockConfigManager;
@@ -381,6 +378,7 @@ public class mcMMO extends JavaPlugin {
         AdvancedConfig.getInstance();
         AdvancedConfig.getInstance();
         PotionConfig.getInstance();
         PotionConfig.getInstance();
         CoreSkillsConfig.getInstance();
         CoreSkillsConfig.getInstance();
+        SoundConfig.getInstance();
 
 
         new ChildConfig();
         new ChildConfig();
 
 

+ 3 - 1
src/main/java/com/gmail/nossr50/party/PartyManager.java

@@ -17,6 +17,8 @@ import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.Permissions;
 import com.gmail.nossr50.util.Permissions;
 import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.player.UserManager;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import org.bukkit.OfflinePlayer;
 import org.bukkit.OfflinePlayer;
 import org.bukkit.Sound;
 import org.bukkit.Sound;
 import org.bukkit.configuration.file.YamlConfiguration;
 import org.bukkit.configuration.file.YamlConfiguration;
@@ -757,7 +759,7 @@ public final class PartyManager {
             member.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, level));
             member.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, level));
 
 
             if (levelUpSoundsEnabled) {
             if (levelUpSoundsEnabled) {
-                member.playSound(member.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
+                SoundManager.sendSound(member, member.getLocation(), SoundType.LEVEL_UP);
             }
             }
         }
         }
     }
     }

+ 3 - 1
src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java

@@ -3,6 +3,8 @@ package com.gmail.nossr50.runnables.skills;
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.util.HolidayManager;
 import com.gmail.nossr50.util.HolidayManager;
 import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.Misc;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import org.bukkit.ChatColor;
 import org.bukkit.ChatColor;
 import org.bukkit.Sound;
 import org.bukkit.Sound;
 import org.bukkit.Statistic;
 import org.bukkit.Statistic;
@@ -22,7 +24,7 @@ public class AprilTask extends BukkitRunnable {
             int random = Misc.getRandom().nextInt(40) + 11;
             int random = Misc.getRandom().nextInt(40) + 11;
             int betterRandom = Misc.getRandom().nextInt(2000);
             int betterRandom = Misc.getRandom().nextInt(2000);
             if (betterRandom == 0) {
             if (betterRandom == 0) {
-                player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
+                SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
                 player.sendMessage(unknown("superskill") + " skill increased by 1. Total (" + unknown("12") + ")");
                 player.sendMessage(unknown("superskill") + " skill increased by 1. Total (" + unknown("12") + ")");
                 fireworksShow(player);
                 fireworksShow(player);
             }
             }

+ 4 - 2
src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java

@@ -2,6 +2,8 @@ package com.gmail.nossr50.runnables.skills;
 
 
 import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.Misc;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import org.bukkit.Location;
 import org.bukkit.Location;
 import org.bukkit.Sound;
 import org.bukkit.Sound;
 import org.bukkit.World;
 import org.bukkit.World;
@@ -85,11 +87,11 @@ public class KrakenAttackTask extends BukkitRunnable {
         player.damage(AdvancedConfig.getInstance().getKrakenAttackDamage(), kraken);
         player.damage(AdvancedConfig.getInstance().getKrakenAttackDamage(), kraken);
 
 
         if (GLOBAL_EFFECTS) {
         if (GLOBAL_EFFECTS) {
-            world.playSound(playerLocation, Sound.ENTITY_GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
+            SoundManager.worldSendSound(world, location, SoundType.KRAKEN);
             world.strikeLightningEffect(playerLocation);
             world.strikeLightningEffect(playerLocation);
         }
         }
         else {
         else {
-            player.playSound(playerLocation, Sound.ENTITY_GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
+            SoundManager.sendSound(player, playerLocation, SoundType.KRAKEN);
             world.createExplosion(playerLocation.getX(), playerLocation.getY(), playerLocation.getZ(), 0F, false, false);
             world.createExplosion(playerLocation.getX(), playerLocation.getY(), playerLocation.getZ(), 0F, false, false);
         }
         }
     }
     }

+ 4 - 2
src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java

@@ -23,6 +23,8 @@ import com.gmail.nossr50.skills.fishing.Fishing.Tier;
 import com.gmail.nossr50.util.*;
 import com.gmail.nossr50.util.*;
 import com.gmail.nossr50.util.skills.CombatUtils;
 import com.gmail.nossr50.util.skills.CombatUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import org.bukkit.*;
 import org.bukkit.*;
 import org.bukkit.block.Block;
 import org.bukkit.block.Block;
 import org.bukkit.block.BlockFace;
 import org.bukkit.block.BlockFace;
@@ -96,7 +98,7 @@ public class FishingManager extends SkillManager {
             world.strikeLightningEffect(location);
             world.strikeLightningEffect(location);
             world.strikeLightningEffect(location);
             world.strikeLightningEffect(location);
 
 
-            world.playSound(location, Sound.ENTITY_GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
+            SoundManager.worldSendSound(world, location, SoundType.KRAKEN);
             mcMMO.p.getServer().broadcastMessage(ChatColor.RED + AdvancedConfig.getInstance().getServerUnleashMessage().replace("(PLAYER)", player.getDisplayName()));
             mcMMO.p.getServer().broadcastMessage(ChatColor.RED + AdvancedConfig.getInstance().getServerUnleashMessage().replace("(PLAYER)", player.getDisplayName()));
         }
         }
         else {
         else {
@@ -104,7 +106,7 @@ public class FishingManager extends SkillManager {
             world.createExplosion(location.getX(), location.getY(), location.getZ(), 0F, false, false);
             world.createExplosion(location.getX(), location.getY(), location.getZ(), 0F, false, false);
             world.createExplosion(location.getX(), location.getY(), location.getZ(), 0F, false, false);
             world.createExplosion(location.getX(), location.getY(), location.getZ(), 0F, false, false);
 
 
-            player.playSound(location, Sound.ENTITY_GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
+            SoundManager.sendSound(player, location, SoundType.KRAKEN);
         }
         }
 
 
         if (player.getInventory().getItemInMainHand().getType() == Material.FISHING_ROD) {
         if (player.getInventory().getItemInMainHand().getType() == Material.FISHING_ROD) {

+ 5 - 2
src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java

@@ -17,6 +17,8 @@ import com.gmail.nossr50.util.Permissions;
 import com.gmail.nossr50.util.StringUtils;
 import com.gmail.nossr50.util.StringUtils;
 import com.gmail.nossr50.util.skills.SkillActivationType;
 import com.gmail.nossr50.util.skills.SkillActivationType;
 import com.gmail.nossr50.util.skills.SkillUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import org.bukkit.Material;
 import org.bukkit.Material;
 import org.bukkit.Sound;
 import org.bukkit.Sound;
 import org.bukkit.enchantments.Enchantment;
 import org.bukkit.enchantments.Enchantment;
@@ -50,7 +52,7 @@ public class RepairManager extends SkillManager {
         }
         }
 
 
         if (Config.getInstance().getRepairAnvilPlaceSoundsEnabled()) {
         if (Config.getInstance().getRepairAnvilPlaceSoundsEnabled()) {
-            player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
+            SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
         }
         }
 
 
         togglePlacedAnvil();
         togglePlacedAnvil();
@@ -149,7 +151,8 @@ public class RepairManager extends SkillManager {
 
 
         // BWONG BWONG BWONG
         // BWONG BWONG BWONG
         if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
         if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
-            player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
+            SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
+            SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
         }
         }
 
 
         // Repair the item!
         // Repair the item!

+ 7 - 3
src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java

@@ -13,6 +13,8 @@ import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.Permissions;
 import com.gmail.nossr50.util.Permissions;
 import com.gmail.nossr50.util.StringUtils;
 import com.gmail.nossr50.util.StringUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import org.bukkit.Location;
 import org.bukkit.Location;
 import org.bukkit.Material;
 import org.bukkit.Material;
 import org.bukkit.Sound;
 import org.bukkit.Sound;
@@ -47,7 +49,7 @@ public class SalvageManager extends SkillManager {
         }
         }
 
 
         if (Config.getInstance().getSalvageAnvilPlaceSoundsEnabled()) {
         if (Config.getInstance().getSalvageAnvilPlaceSoundsEnabled()) {
-            player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
+            SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
         }
         }
 
 
         togglePlacedAnvil();
         togglePlacedAnvil();
@@ -122,8 +124,10 @@ public class SalvageManager extends SkillManager {
 
 
         // BWONG BWONG BWONG - CLUNK!
         // BWONG BWONG BWONG - CLUNK!
         if (Config.getInstance().getSalvageAnvilUseSoundsEnabled()) {
         if (Config.getInstance().getSalvageAnvilUseSoundsEnabled()) {
-            player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
-            player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F);
+            SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
+            SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
+
+            //player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F);
         }
         }
 
 
         player.sendMessage(LocaleLoader.getString("Salvage.Skills.Success"));
         player.sendMessage(LocaleLoader.getString("Salvage.Skills.Success"));

+ 3 - 2
src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java

@@ -18,9 +18,10 @@ import com.gmail.nossr50.util.Permissions;
 import com.gmail.nossr50.util.skills.ParticleEffectUtils;
 import com.gmail.nossr50.util.skills.ParticleEffectUtils;
 import com.gmail.nossr50.util.skills.SkillActivationType;
 import com.gmail.nossr50.util.skills.SkillActivationType;
 import com.gmail.nossr50.util.skills.SkillUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import org.bukkit.ChatColor;
 import org.bukkit.ChatColor;
 import org.bukkit.Material;
 import org.bukkit.Material;
-import org.bukkit.Sound;
 import org.bukkit.block.BlockState;
 import org.bukkit.block.BlockState;
 import org.bukkit.entity.Player;
 import org.bukkit.entity.Player;
 import org.bukkit.event.inventory.FurnaceBurnEvent;
 import org.bukkit.event.inventory.FurnaceBurnEvent;
@@ -89,7 +90,7 @@ public class SmeltingManager extends SkillManager {
             blockState.setType(Material.AIR);
             blockState.setType(Material.AIR);
 
 
             if (Config.getInstance().getFluxPickaxeSoundEnabled()) {
             if (Config.getInstance().getFluxPickaxeSoundEnabled()) {
-                player.playSound(blockState.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, Misc.FIZZ_VOLUME, Misc.getFizzPitch());
+                SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ);
             }
             }
 
 
             ParticleEffectUtils.playFluxEffect(blockState.getLocation());
             ParticleEffectUtils.playFluxEffect(blockState.getLocation());

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

@@ -8,6 +8,8 @@ import com.gmail.nossr50.runnables.items.ChimaeraWingWarmup;
 import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.skills.CombatUtils;
 import com.gmail.nossr50.util.skills.CombatUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import org.bukkit.*;
 import org.bukkit.*;
 import org.bukkit.entity.Player;
 import org.bukkit.entity.Player;
 import org.bukkit.inventory.ItemStack;
 import org.bukkit.inventory.ItemStack;
@@ -131,7 +133,7 @@ public final class ChimaeraWing {
         mcMMOPlayer.setTeleportCommenceLocation(null);
         mcMMOPlayer.setTeleportCommenceLocation(null);
 
 
         if (Config.getInstance().getChimaeraSoundEnabled()) {
         if (Config.getInstance().getChimaeraSoundEnabled()) {
-            player.playSound(location, Sound.ENTITY_BAT_TAKEOFF, Misc.BAT_VOLUME, Misc.BAT_PITCH);
+            SoundManager.sendSound(player, location, SoundType.CHIMAERA_WING);
         }
         }
 
 
         player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
         player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));

+ 3 - 1
src/main/java/com/gmail/nossr50/util/HolidayManager.java

@@ -5,6 +5,8 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkill;
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.skills.ParticleEffectUtils;
 import com.gmail.nossr50.util.skills.ParticleEffectUtils;
+import com.gmail.nossr50.util.sounds.SoundManager;
+import com.gmail.nossr50.util.sounds.SoundType;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableList;
 import org.bukkit.*;
 import org.bukkit.*;
 import org.bukkit.FireworkEffect.Type;
 import org.bukkit.FireworkEffect.Type;
@@ -357,7 +359,7 @@ public final class HolidayManager {
 
 
     public void levelUpApril(Player player, FakeSkillType fakeSkillType) {
     public void levelUpApril(Player player, FakeSkillType fakeSkillType) {
         int levelTotal = Misc.getRandom().nextInt(1 + UserManager.getPlayer(player).getSkillLevel(PrimarySkill.MINING)) + 1;
         int levelTotal = Misc.getRandom().nextInt(1 + UserManager.getPlayer(player).getSkillLevel(PrimarySkill.MINING)) + 1;
-        player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
+        SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
         player.sendMessage(ChatColor.YELLOW + StringUtils.getCapitalized(fakeSkillType.toString()) + " skill increased by 1. Total (" + levelTotal + ")");
         player.sendMessage(ChatColor.YELLOW + StringUtils.getCapitalized(fakeSkillType.toString()) + " skill increased by 1. Total (" + levelTotal + ")");
         ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size())));
         ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size())));
     }
     }

+ 2 - 14
src/main/java/com/gmail/nossr50/util/Misc.java

@@ -31,7 +31,7 @@ public final class Misc {
     public static final double SKILL_MESSAGE_MAX_SENDING_DISTANCE = 10.0;
     public static final double SKILL_MESSAGE_MAX_SENDING_DISTANCE = 10.0;
 
 
     // Sound Pitches & Volumes from CB
     // 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_PITCH  = 0.3F;  // Not in CB directly, I went off the place sound values
     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 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 FIZZ_VOLUME      = 0.5F * Config.getInstance().getMasterVolume();
     public static final float POP_VOLUME       = 0.2F * Config.getInstance().getMasterVolume();
     public static final float POP_VOLUME       = 0.2F * Config.getInstance().getMasterVolume();
@@ -39,24 +39,12 @@ public final class Misc {
     public static final float BAT_PITCH        = 0.6F;
     public static final float BAT_PITCH        = 0.6F;
     public static final float GHAST_VOLUME     = 1.0F * Config.getInstance().getMasterVolume();
     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_PITCH    = 0.5F;  // Reduced to differentiate between vanilla level-up
-    public static final float LEVELUP_VOLUME   = 0.75F * Config.getInstance().getMasterVolume(); // 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");
     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");
 
 
     private Misc() {};
     private Misc() {};
 
 
-    public static float getFizzPitch() {
-        return 2.6F + (getRandom().nextFloat() - getRandom().nextFloat()) * 0.8F;
-    }
-
-    public static float getPopPitch() {
-        return ((getRandom().nextFloat() - getRandom().nextFloat()) * 0.7F + 1.0F) * 2.0F;
-    }
-
-    public static float getGhastPitch() {
-        return (getRandom().nextFloat() - getRandom().nextFloat()) * 0.2F + 1.0F;
-    }
-
     public static boolean isNPCEntity(Entity entity) {
     public static boolean isNPCEntity(Entity entity) {
         return (entity == null || entity.hasMetadata("NPC") || entity instanceof NPC || entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
         return (entity == null || entity.hasMetadata("NPC") || entity instanceof NPC || entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
     }
     }

+ 81 - 0
src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java

@@ -0,0 +1,81 @@
+package com.gmail.nossr50.util.sounds;
+
+import com.gmail.nossr50.config.SoundConfig;
+import com.gmail.nossr50.util.Misc;
+import org.bukkit.Location;
+import org.bukkit.Sound;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+
+public class SoundManager {
+    /**
+     * Sends a sound to the player
+     * @param soundType the type of sound
+     */
+    public static void sendSound(Player player, Location location, SoundType soundType)
+    {
+        player.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
+    }
+
+    public static void worldSendSound(World world, Location location, SoundType soundType)
+    {
+        world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
+    }
+
+    /**
+     * All volume is multiplied by the master volume to get its final value
+     * @param soundType target soundtype
+     * @return the volume for this soundtype
+     */
+    private static float getVolume(SoundType soundType)
+    {
+        return SoundConfig.getInstance().getVolume(soundType) * SoundConfig.getInstance().getMasterVolume();
+    }
+
+    private static float getPitch(SoundType soundType)
+    {
+        if(soundType == SoundType.FIZZ)
+            return getFizzPitch();
+        else if (soundType == SoundType.POP)
+            return getPopPitch();
+        else if (soundType == SoundType.KRAKEN)
+            return getKrakenPitch();
+        else
+            return SoundConfig.getInstance().getPitch(soundType);
+    }
+
+    private static Sound getSound(SoundType soundType)
+    {
+        switch(soundType)
+        {
+            case ANVIL:
+                return Sound.BLOCK_ANVIL_PLACE;
+            case ITEM_BREAK:
+                return Sound.ENTITY_ITEM_BREAK;
+            case POP:
+                return Sound.ENTITY_ITEM_PICKUP;
+            case KRAKEN:
+                return Sound.ENTITY_GHAST_SCREAM;
+            case CHIMAERA_WING:
+                return Sound.ENTITY_BAT_TAKEOFF;
+            case LEVEL_UP:
+                return Sound.ENTITY_PLAYER_LEVELUP;
+            case FIZZ:
+                return Sound.BLOCK_FIRE_EXTINGUISH;
+            default:
+                return null;
+        }
+    }
+
+    public static float getFizzPitch() {
+        return 2.6F + (Misc.getRandom().nextFloat() - Misc.getRandom().nextFloat()) * 0.8F;
+    }
+
+    public static float getPopPitch() {
+        return ((Misc.getRandom().nextFloat() - Misc.getRandom().nextFloat()) * 0.7F + 1.0F) * 2.0F;
+    }
+
+    public static float getKrakenPitch() {
+        return (Misc.getRandom().nextFloat() - Misc.getRandom().nextFloat()) * 0.2F + 1.0F;
+    }
+}

+ 23 - 0
src/main/java/com/gmail/nossr50/util/sounds/SoundType.java

@@ -0,0 +1,23 @@
+package com.gmail.nossr50.util.sounds;
+
+public enum SoundType {
+    ANVIL,
+    LEVEL_UP,
+    FIZZ,
+    ITEM_BREAK,
+    POP,
+    KRAKEN,
+    CHIMAERA_WING;
+
+    public boolean usesCustomPitch()
+    {
+        switch(this){
+            case POP:
+            case FIZZ:
+            case KRAKEN:
+                return true;
+            default:
+                return false;
+        }
+    }
+}

+ 27 - 0
src/main/resources/sounds.yml

@@ -0,0 +1,27 @@
+# A volume of 1.0 is pretty loud
+# Keep this in mind
+Sounds:
+    # 1.0 = Max volume
+    # 0.0 = No Volume
+    MasterVolume: 1.0
+    ANVIL:
+      Volume: 1.0
+      Pitch: 0.3
+    #Fizz, Pop, and Kraken make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard
+    FIZZ:
+      Volume: 0.5
+    LEVEL_UP:
+      Volume: 0.75
+      Pitch: 0.5
+    ITEM_BREAK:
+      Volume: 1.0
+      Pitch: 1.0
+    #Fizz, Pop, and Kraken make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard
+    POP:
+      Volume: 0.2
+    #Fizz, Pop, and Kraken make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard
+    KRAKEN:
+      Volume: 1.0
+    CHIMAERA_WING:
+      Volume: 1.0
+      Pitch: 0.6