From b73eced36f03ba9e48194e566a2fdb4a0066c0d4 Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Wed, 25 Jul 2018 20:29:40 -0400 Subject: [PATCH] Remove sound adapter --- .../gmail/nossr50/datatypes/party/Party.java | 32 +++---- .../nossr50/datatypes/player/McMMOPlayer.java | 35 ++++--- .../nossr50/listeners/BlockListener.java | 59 ++++++------ .../nossr50/listeners/PlayerListener.java | 6 +- .../com/gmail/nossr50/party/PartyManager.java | 32 +++---- .../nossr50/runnables/skills/AprilTask.java | 10 +- .../runnables/skills/KrakenAttackTask.java | 10 +- .../skills/fishing/FishingManager.java | 5 +- .../nossr50/skills/repair/RepairManager.java | 42 ++++----- .../skills/salvage/SalvageManager.java | 38 ++++---- .../skills/smelting/SmeltingManager.java | 42 ++++----- .../nossr50/skills/taming/TamingManager.java | 31 +++---- .../skills/taming/TrackedTamingEntity.java | 16 ++-- .../com/gmail/nossr50/util/ChimaeraWing.java | 24 +++-- .../gmail/nossr50/util/HolidayManager.java | 3 +- .../nossr50/util/adapter/SoundAdapter.java | 91 ------------------- 16 files changed, 173 insertions(+), 303 deletions(-) delete mode 100644 src/main/java/com/gmail/nossr50/util/adapter/SoundAdapter.java diff --git a/src/main/java/com/gmail/nossr50/datatypes/party/Party.java b/src/main/java/com/gmail/nossr50/datatypes/party/Party.java index f40842473..2152b5fbe 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/party/Party.java +++ b/src/main/java/com/gmail/nossr50/datatypes/party/Party.java @@ -1,5 +1,18 @@ package com.gmail.nossr50.datatypes.party; +import com.gmail.nossr50.config.Config; +import com.gmail.nossr50.config.experience.ExperienceConfig; +import com.gmail.nossr50.datatypes.experience.FormulaType; +import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.party.PartyManager; +import com.gmail.nossr50.util.EventUtils; +import com.gmail.nossr50.util.Misc; +import org.bukkit.ChatColor; +import org.bukkit.Sound; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + import java.text.DecimalFormat; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -7,21 +20,6 @@ import java.util.List; import java.util.Map.Entry; import java.util.UUID; -import org.bukkit.ChatColor; -import org.bukkit.Sound; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.Config; -import com.gmail.nossr50.config.experience.ExperienceConfig; -import com.gmail.nossr50.datatypes.experience.FormulaType; -import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.party.PartyManager; -import com.gmail.nossr50.util.EventUtils; -import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.adapter.SoundAdapter; - public class Party { private final LinkedHashMap members = new LinkedHashMap(); private final List onlineMembers = new ArrayList(); @@ -228,7 +226,7 @@ public class Party { leader.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, getLevel())); if (Config.getInstance().getLevelUpSoundsEnabled()) { - leader.playSound(leader.getLocation(), SoundAdapter.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); + leader.playSound(leader.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); } } return; @@ -338,7 +336,7 @@ public class Party { } if (!nearMembers.contains(member) && !playerName.equalsIgnoreCase(memberName)) { - memberList.append(ChatColor.ITALIC).append(""); + memberList.append(ChatColor.ITALIC); } memberList.append(memberName).append(ChatColor.RESET).append(" "); diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index 0c9a3d72f..5a757b95f 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -1,21 +1,5 @@ package com.gmail.nossr50.datatypes.player; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -import com.gmail.nossr50.runnables.skills.BleedTimerTask; -import com.gmail.nossr50.util.player.UserManager; -import com.gmail.nossr50.util.scoreboards.ScoreboardManager; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.metadata.FixedMetadataValue; - -import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.experience.ExperienceConfig; @@ -28,9 +12,11 @@ import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.ToolType; import com.gmail.nossr50.datatypes.skills.XPGainReason; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.party.ShareHandler; import com.gmail.nossr50.runnables.skills.AbilityDisableTask; +import com.gmail.nossr50.runnables.skills.BleedTimerTask; import com.gmail.nossr50.runnables.skills.ToolLowerTask; import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager; @@ -53,12 +39,23 @@ import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.StringUtils; -import com.gmail.nossr50.util.adapter.SoundAdapter; +import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.skills.PerksUtils; import com.gmail.nossr50.util.skills.SkillUtils; - import org.apache.commons.lang.Validate; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.metadata.FixedMetadataValue; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.UUID; public class McMMOPlayer { private Player player; @@ -505,7 +502,7 @@ public class McMMOPlayer { } if (Config.getInstance().getLevelUpSoundsEnabled()) { - player.playSound(player.getLocation(), SoundAdapter.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); + player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); } player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(skillType.toString()) + ".Skillup", levelsGained, getSkillLevel(skillType))); diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 2822c44ed..97978a051 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -1,10 +1,30 @@ package com.gmail.nossr50.listeners; -import java.util.List; - +import com.gmail.nossr50.config.Config; +import com.gmail.nossr50.config.HiddenConfig; +import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.datatypes.skills.AbilityType; +import com.gmail.nossr50.datatypes.skills.SkillType; +import com.gmail.nossr50.datatypes.skills.ToolType; +import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; +import com.gmail.nossr50.events.fake.FakeBlockDamageEvent; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.skills.alchemy.Alchemy; +import com.gmail.nossr50.skills.excavation.ExcavationManager; +import com.gmail.nossr50.skills.herbalism.Herbalism; +import com.gmail.nossr50.skills.herbalism.HerbalismManager; +import com.gmail.nossr50.skills.mining.MiningManager; +import com.gmail.nossr50.skills.repair.Repair; +import com.gmail.nossr50.skills.salvage.Salvage; +import com.gmail.nossr50.skills.smelting.SmeltingManager; +import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager; +import com.gmail.nossr50.util.*; +import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; @@ -18,36 +38,11 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.*; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.inventory.ItemStack; - -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.Config; -import com.gmail.nossr50.config.HiddenConfig; -import com.gmail.nossr50.datatypes.player.McMMOPlayer; -import com.gmail.nossr50.datatypes.skills.AbilityType; -import com.gmail.nossr50.datatypes.skills.SkillType; -import com.gmail.nossr50.datatypes.skills.ToolType; -import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; -import com.gmail.nossr50.events.fake.FakeBlockDamageEvent; -import com.gmail.nossr50.skills.alchemy.Alchemy; -import com.gmail.nossr50.skills.excavation.ExcavationManager; -import com.gmail.nossr50.skills.herbalism.Herbalism; -import com.gmail.nossr50.skills.herbalism.HerbalismManager; -import com.gmail.nossr50.skills.mining.MiningManager; -import com.gmail.nossr50.skills.repair.Repair; -import com.gmail.nossr50.skills.salvage.Salvage; -import com.gmail.nossr50.skills.smelting.SmeltingManager; -import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager; -import com.gmail.nossr50.util.BlockUtils; -import com.gmail.nossr50.util.EventUtils; -import com.gmail.nossr50.util.ItemUtils; -import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.adapter.SoundAdapter; -import com.gmail.nossr50.util.player.UserManager; -import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; +import java.util.List; + public class BlockListener implements Listener { private final mcMMO plugin; @@ -358,7 +353,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. */ if (mcMMOPlayer.getAbilityMode(AbilityType.TREE_FELLER) && BlockUtils.isLog(blockState) && Config.getInstance().getTreeFellerSoundsEnabled()) { - player.playSound(blockState.getLocation(), SoundAdapter.FIZZ, Misc.FIZZ_VOLUME, Misc.getFizzPitch()); + player.playSound(blockState.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, Misc.FIZZ_VOLUME, Misc.getFizzPitch()); } } @@ -397,7 +392,7 @@ public class BlockListener implements Listener { else if (mcMMOPlayer.getAbilityMode(AbilityType.BERSERK) && heldItem.getType() == Material.AIR) { if (AbilityType.BERSERK.blockCheck(block.getState()) && EventUtils.simulateBlockBreak(block, player, true)) { event.setInstaBreak(true); - player.playSound(block.getLocation(), SoundAdapter.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch()); + player.playSound(block.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch()); } else if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState) && EventUtils.simulateBlockBreak(block, player, true)) { if (mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) { @@ -407,7 +402,7 @@ public class BlockListener implements Listener { } else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && BlockUtils.isLeaves(blockState) && EventUtils.simulateBlockBreak(block, player, true)) { event.setInstaBreak(true); - player.playSound(blockState.getLocation(), SoundAdapter.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch()); + player.playSound(blockState.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch()); } } } diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 971f06be1..c5db2c0f8 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -24,11 +24,11 @@ import com.gmail.nossr50.skills.salvage.SalvageManager; import com.gmail.nossr50.skills.taming.TamingManager; import com.gmail.nossr50.skills.unarmed.Unarmed; import com.gmail.nossr50.util.*; -import com.gmail.nossr50.util.adapter.SoundAdapter; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.GameMode; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.entity.*; @@ -300,7 +300,7 @@ public class PlayerListener implements Listener { event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer)); if (event.isCancelled()) { - player.playSound(player.getLocation(), SoundAdapter.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch()); + player.playSound(player.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch()); return; } } @@ -311,7 +311,7 @@ public class PlayerListener implements Listener { event.setCancelled(cancel); if (pickupSuccess) { - player.playSound(player.getLocation(), SoundAdapter.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch()); + player.playSound(player.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch()); player.updateInventory(); return; } diff --git a/src/main/java/com/gmail/nossr50/party/PartyManager.java b/src/main/java/com/gmail/nossr50/party/PartyManager.java index ebafb0814..ec0ad94fe 100644 --- a/src/main/java/com/gmail/nossr50/party/PartyManager.java +++ b/src/main/java/com/gmail/nossr50/party/PartyManager.java @@ -1,18 +1,5 @@ package com.gmail.nossr50.party; -import java.io.File; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map.Entry; -import java.util.UUID; - -import org.bukkit.OfflinePlayer; -import org.bukkit.Sound; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; - -import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.chat.ChatMode; import com.gmail.nossr50.datatypes.database.UpgradeType; @@ -26,9 +13,20 @@ import com.gmail.nossr50.events.party.McMMOPartyAllianceChangeEvent; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.adapter.SoundAdapter; import com.gmail.nossr50.util.player.UserManager; +import org.bukkit.OfflinePlayer; +import org.bukkit.Sound; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map.Entry; +import java.util.UUID; public final class PartyManager { private static String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml"; @@ -72,9 +70,7 @@ public final class PartyManager { removeFromParty(mcMMOPlayer); } - else if (!handlePartyChangeEvent(player, null, newPartyName, EventReason.JOINED_PARTY)) { - return false; - } + else return handlePartyChangeEvent(player, null, newPartyName, EventReason.JOINED_PARTY); return true; } @@ -730,7 +726,7 @@ public final class PartyManager { member.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, level)); if (levelUpSoundsEnabled) { - member.playSound(member.getLocation(), SoundAdapter.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); + member.playSound(member.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); } } } diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java index 7299e7545..f66949965 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java @@ -1,16 +1,14 @@ package com.gmail.nossr50.runnables.skills; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.HolidayManager; +import com.gmail.nossr50.util.Misc; import org.bukkit.ChatColor; import org.bukkit.Sound; import org.bukkit.Statistic; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.util.HolidayManager; -import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.adapter.SoundAdapter; - public class AprilTask extends BukkitRunnable { @Override @@ -24,7 +22,7 @@ public class AprilTask extends BukkitRunnable { int random = Misc.getRandom().nextInt(40) + 11; int betterRandom = Misc.getRandom().nextInt(2000); if (betterRandom == 0) { - player.playSound(player.getLocation(), SoundAdapter.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); + player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); player.sendMessage(unknown("superskill") + " skill increased by 1. Total (" + unknown("12") + ")"); fireworksShow(player); } diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java index 4e12cd6bf..2be0c1575 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java @@ -1,5 +1,7 @@ package com.gmail.nossr50.runnables.skills; +import com.gmail.nossr50.config.AdvancedConfig; +import com.gmail.nossr50.util.Misc; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.World; @@ -7,10 +9,6 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; -import com.gmail.nossr50.config.AdvancedConfig; -import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.adapter.SoundAdapter; - public class KrakenAttackTask extends BukkitRunnable { private LivingEntity kraken; private Player player; @@ -87,11 +85,11 @@ public class KrakenAttackTask extends BukkitRunnable { player.damage(AdvancedConfig.getInstance().getKrakenAttackDamage(), kraken); if (GLOBAL_EFFECTS) { - world.playSound(playerLocation, SoundAdapter.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); + world.playSound(playerLocation, Sound.ENTITY_GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); world.strikeLightningEffect(playerLocation); } else { - player.playSound(playerLocation, SoundAdapter.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); + player.playSound(playerLocation, Sound.ENTITY_GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); world.createExplosion(playerLocation.getX(), playerLocation.getY(), playerLocation.getZ(), 0F, false, false); } } diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index 7dda45014..923daa920 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -21,7 +21,6 @@ import com.gmail.nossr50.runnables.skills.KrakenAttackTask; import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.fishing.Fishing.Tier; import com.gmail.nossr50.util.*; -import com.gmail.nossr50.util.adapter.SoundAdapter; import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.*; @@ -97,7 +96,7 @@ public class FishingManager extends SkillManager { world.strikeLightningEffect(location); world.strikeLightningEffect(location); - world.playSound(location, SoundAdapter.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); + world.playSound(location, Sound.ENTITY_GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); mcMMO.p.getServer().broadcastMessage(ChatColor.RED + AdvancedConfig.getInstance().getServerUnleashMessage().replace("(PLAYER)", player.getDisplayName())); } else { @@ -105,7 +104,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); - player.playSound(location, SoundAdapter.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); + player.playSound(location, Sound.ENTITY_GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); } if (player.getInventory().getItemInMainHand().getType() == Material.FISHING_ROD) { diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java index 39dd6db99..07374f903 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java @@ -1,8 +1,21 @@ package com.gmail.nossr50.skills.repair; -import java.util.Map; -import java.util.Map.Entry; - +import com.gmail.nossr50.config.Config; +import com.gmail.nossr50.config.experience.ExperienceConfig; +import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.datatypes.skills.SecondaryAbility; +import com.gmail.nossr50.datatypes.skills.SkillType; +import com.gmail.nossr50.datatypes.skills.XPGainReason; +import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.skills.SkillManager; +import com.gmail.nossr50.skills.repair.ArcaneForging.Tier; +import com.gmail.nossr50.skills.repair.repairables.Repairable; +import com.gmail.nossr50.util.EventUtils; +import com.gmail.nossr50.util.Misc; +import com.gmail.nossr50.util.Permissions; +import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.enchantments.Enchantment; @@ -11,23 +24,8 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.material.MaterialData; -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.Config; -import com.gmail.nossr50.config.experience.ExperienceConfig; -import com.gmail.nossr50.datatypes.player.McMMOPlayer; -import com.gmail.nossr50.datatypes.skills.SecondaryAbility; -import com.gmail.nossr50.datatypes.skills.SkillType; -import com.gmail.nossr50.datatypes.skills.XPGainReason; -import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.skills.SkillManager; -import com.gmail.nossr50.skills.repair.ArcaneForging.Tier; -import com.gmail.nossr50.skills.repair.repairables.Repairable; -import com.gmail.nossr50.util.EventUtils; -import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; -import com.gmail.nossr50.util.adapter.SoundAdapter; -import com.gmail.nossr50.util.skills.SkillUtils; +import java.util.Map; +import java.util.Map.Entry; public class RepairManager extends SkillManager { private boolean placedAnvil; @@ -52,7 +50,7 @@ public class RepairManager extends SkillManager { } if (Config.getInstance().getRepairAnvilPlaceSoundsEnabled()) { - player.playSound(player.getLocation(), SoundAdapter.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH); + player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH); } togglePlacedAnvil(); @@ -151,7 +149,7 @@ public class RepairManager extends SkillManager { // BWONG BWONG BWONG if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) { - player.playSound(player.getLocation(), SoundAdapter.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH); + player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH); } // Repair the item! diff --git a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java index 10efb41ac..ab7efb3f8 100644 --- a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java +++ b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java @@ -1,8 +1,18 @@ package com.gmail.nossr50.skills.salvage; -import java.util.Map; -import java.util.Map.Entry; - +import com.gmail.nossr50.config.Config; +import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.datatypes.skills.SkillType; +import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.skills.SkillManager; +import com.gmail.nossr50.skills.salvage.Salvage.Tier; +import com.gmail.nossr50.skills.salvage.salvageables.Salvageable; +import com.gmail.nossr50.util.EventUtils; +import com.gmail.nossr50.util.Misc; +import com.gmail.nossr50.util.Permissions; +import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -12,20 +22,8 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.EnchantmentStorageMeta; import org.bukkit.material.MaterialData; -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.Config; -import com.gmail.nossr50.datatypes.player.McMMOPlayer; -import com.gmail.nossr50.datatypes.skills.SkillType; -import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.skills.SkillManager; -import com.gmail.nossr50.skills.salvage.Salvage.Tier; -import com.gmail.nossr50.skills.salvage.salvageables.Salvageable; -import com.gmail.nossr50.util.EventUtils; -import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; -import com.gmail.nossr50.util.adapter.SoundAdapter; -import com.gmail.nossr50.util.skills.SkillUtils; +import java.util.Map; +import java.util.Map.Entry; public class SalvageManager extends SkillManager { private boolean placedAnvil; @@ -50,7 +48,7 @@ public class SalvageManager extends SkillManager { } if (Config.getInstance().getSalvageAnvilPlaceSoundsEnabled()) { - player.playSound(player.getLocation(), SoundAdapter.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH); + player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH); } togglePlacedAnvil(); @@ -127,8 +125,8 @@ public class SalvageManager extends SkillManager { // BWONG BWONG BWONG - CLUNK! if (Config.getInstance().getSalvageAnvilUseSoundsEnabled()) { - player.playSound(player.getLocation(), SoundAdapter.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH); - player.playSound(player.getLocation(), SoundAdapter.ITEM_BREAK, 1.0F, 1.0F); + 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); } player.sendMessage(LocaleLoader.getString("Salvage.Skills.Success")); diff --git a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java index 3bf41ef96..76c64d89b 100644 --- a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java @@ -1,8 +1,22 @@ package com.gmail.nossr50.skills.smelting; -import java.util.ArrayList; -import java.util.List; - +import com.gmail.nossr50.config.Config; +import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.datatypes.skills.SecondaryAbility; +import com.gmail.nossr50.datatypes.skills.SkillType; +import com.gmail.nossr50.datatypes.skills.XPGainReason; +import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent; +import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.skills.SkillManager; +import com.gmail.nossr50.skills.mining.Mining; +import com.gmail.nossr50.skills.smelting.Smelting.Tier; +import com.gmail.nossr50.util.BlockUtils; +import com.gmail.nossr50.util.EventUtils; +import com.gmail.nossr50.util.Misc; +import com.gmail.nossr50.util.Permissions; +import com.gmail.nossr50.util.skills.ParticleEffectUtils; +import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -13,24 +27,8 @@ import org.bukkit.inventory.FurnaceRecipe; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.Config; -import com.gmail.nossr50.datatypes.player.McMMOPlayer; -import com.gmail.nossr50.datatypes.skills.SecondaryAbility; -import com.gmail.nossr50.datatypes.skills.SkillType; -import com.gmail.nossr50.datatypes.skills.XPGainReason; -import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent; -import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.skills.SkillManager; -import com.gmail.nossr50.skills.mining.Mining; -import com.gmail.nossr50.skills.smelting.Smelting.Tier; -import com.gmail.nossr50.util.BlockUtils; -import com.gmail.nossr50.util.EventUtils; -import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.adapter.SoundAdapter; -import com.gmail.nossr50.util.skills.ParticleEffectUtils; -import com.gmail.nossr50.util.skills.SkillUtils; +import java.util.ArrayList; +import java.util.List; public class SmeltingManager extends SkillManager { public SmeltingManager(McMMOPlayer mcMMOPlayer) { @@ -90,7 +88,7 @@ public class SmeltingManager extends SkillManager { blockState.setType(Material.AIR); if (Config.getInstance().getFluxPickaxeSoundEnabled()) { - player.playSound(blockState.getLocation(), SoundAdapter.FIZZ, Misc.FIZZ_VOLUME, Misc.getFizzPitch()); + player.playSound(blockState.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, Misc.FIZZ_VOLUME, Misc.getFizzPitch()); } ParticleEffectUtils.playFluxEffect(blockState.getLocation()); diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index 507492969..c3af433b5 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -1,22 +1,5 @@ package com.gmail.nossr50.skills.taming; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Horse; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Ocelot; -import org.bukkit.entity.Player; -import org.bukkit.entity.Tameable; -import org.bukkit.entity.Wolf; -import org.bukkit.inventory.ItemStack; - -import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.experience.ExperienceConfig; @@ -27,15 +10,23 @@ import com.gmail.nossr50.datatypes.skills.XPGainReason; import com.gmail.nossr50.events.fake.FakeEntityTameEvent; import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.runnables.skills.BleedTimerTask; import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.StringUtils; -import com.gmail.nossr50.util.adapter.SoundAdapter; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.skills.SkillUtils; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.*; +import org.bukkit.inventory.ItemStack; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; public class TamingManager extends SkillManager { public TamingManager(McMMOPlayer mcMMOPlayer) { @@ -119,7 +110,7 @@ public class TamingManager extends SkillManager { BleedTimerTask.add(target, Taming.goreBleedTicks); if (target instanceof Player) { - ((Player) target).sendMessage(LocaleLoader.getString("Combat.StruckByGore")); + target.sendMessage(LocaleLoader.getString("Combat.StruckByGore")); } getPlayer().sendMessage(LocaleLoader.getString("Combat.Gore")); @@ -322,7 +313,7 @@ public class TamingManager extends SkillManager { } player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete") + lifeSpan); - player.playSound(location, SoundAdapter.FIREWORK_BLAST_FAR, 1F, 0.5F); + player.playSound(location, Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR, 1F, 0.5F); } private boolean rangeCheck(EntityType type) { diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TrackedTamingEntity.java b/src/main/java/com/gmail/nossr50/skills/taming/TrackedTamingEntity.java index 06007206e..51bb6afb7 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TrackedTamingEntity.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TrackedTamingEntity.java @@ -1,19 +1,17 @@ package com.gmail.nossr50.skills.taming; -import java.util.UUID; - +import com.gmail.nossr50.config.Config; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.Misc; +import com.gmail.nossr50.util.skills.CombatUtils; +import com.gmail.nossr50.util.skills.ParticleEffectUtils; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.LivingEntity; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.scheduler.BukkitRunnable; -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.Config; -import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.adapter.SoundAdapter; -import com.gmail.nossr50.util.skills.CombatUtils; -import com.gmail.nossr50.util.skills.ParticleEffectUtils; +import java.util.UUID; public class TrackedTamingEntity extends BukkitRunnable { private LivingEntity livingEntity; @@ -36,7 +34,7 @@ public class TrackedTamingEntity extends BukkitRunnable { public void run() { if (livingEntity.isValid()) { Location location = livingEntity.getLocation(); - location.getWorld().playSound(location, SoundAdapter.FIZZ, 0.8F, 0.8F); + location.getWorld().playSound(location, Sound.BLOCK_FIRE_EXTINGUISH, 0.8F, 0.8F); ParticleEffectUtils.playCallOfTheWildEffect(livingEntity); CombatUtils.dealDamage(livingEntity, livingEntity.getMaxHealth(), DamageCause.SUICIDE, livingEntity); } diff --git a/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java b/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java index 9f34003a9..b4266a538 100644 --- a/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java +++ b/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java @@ -1,8 +1,13 @@ package com.gmail.nossr50.util; -import java.util.ArrayList; -import java.util.List; - +import com.gmail.nossr50.config.Config; +import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.runnables.items.ChimaeraWingWarmup; +import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.skills.CombatUtils; +import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.*; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -10,15 +15,8 @@ import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.util.Vector; -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.Config; -import com.gmail.nossr50.datatypes.player.McMMOPlayer; -import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.runnables.items.ChimaeraWingWarmup; -import com.gmail.nossr50.util.adapter.SoundAdapter; -import com.gmail.nossr50.util.player.UserManager; -import com.gmail.nossr50.util.skills.CombatUtils; -import com.gmail.nossr50.util.skills.SkillUtils; +import java.util.ArrayList; +import java.util.List; public final class ChimaeraWing { private static McMMOPlayer mcMMOPlayer; @@ -133,7 +131,7 @@ public final class ChimaeraWing { mcMMOPlayer.setTeleportCommenceLocation(null); if (Config.getInstance().getChimaeraSoundEnabled()) { - player.playSound(location, SoundAdapter.BAT_TAKEOFF, Misc.BAT_VOLUME, Misc.BAT_PITCH); + player.playSound(location, Sound.ENTITY_BAT_TAKEOFF, Misc.BAT_VOLUME, Misc.BAT_PITCH); } player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass")); diff --git a/src/main/java/com/gmail/nossr50/util/HolidayManager.java b/src/main/java/com/gmail/nossr50/util/HolidayManager.java index 26e6a01f8..1b40c7f59 100644 --- a/src/main/java/com/gmail/nossr50/util/HolidayManager.java +++ b/src/main/java/com/gmail/nossr50/util/HolidayManager.java @@ -3,7 +3,6 @@ package com.gmail.nossr50.util; import com.gmail.nossr50.commands.skills.AprilCommand; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.util.adapter.SoundAdapter; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.google.common.collect.ImmutableList; @@ -358,7 +357,7 @@ public final class HolidayManager { public void levelUpApril(Player player, FakeSkillType fakeSkillType) { int levelTotal = Misc.getRandom().nextInt(1 + UserManager.getPlayer(player).getSkillLevel(SkillType.MINING)) + 1; - player.playSound(player.getLocation(), SoundAdapter.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); + player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); 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()))); } diff --git a/src/main/java/com/gmail/nossr50/util/adapter/SoundAdapter.java b/src/main/java/com/gmail/nossr50/util/adapter/SoundAdapter.java deleted file mode 100644 index eb2d45295..000000000 --- a/src/main/java/com/gmail/nossr50/util/adapter/SoundAdapter.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.gmail.nossr50.util.adapter; - -import org.bukkit.Sound; - -public class SoundAdapter { - public static final Sound FIZZ; - public static final Sound LEVEL_UP; - public static final Sound FIREWORK_BLAST_FAR; - public static final Sound ITEM_PICKUP; - public static final Sound GHAST_SCREAM; - public static final Sound ANVIL_LAND; - public static final Sound ANVIL_USE; - public static final Sound ITEM_BREAK; - public static final Sound BAT_TAKEOFF; - - static { - Sound temp = null; - try { - temp = Sound.valueOf("BLOCK_FIRE_EXTINGUISH"); - } catch (Exception e) { - temp = Sound.valueOf("FIZZ"); - } finally { - FIZZ = temp; - } - temp = null; - try { - temp = Sound.valueOf("ENTITY_PLAYER_LEVELUP"); - } catch (Exception e) { - temp = Sound.valueOf("LEVEL_UP"); - } finally { - LEVEL_UP = temp; - } - temp = null; - try { - temp = Sound.valueOf("ENTITY_GHAST_SCREAM"); - } catch (Exception e) { - temp = Sound.valueOf("GHAST_SCREAM"); - } finally { - GHAST_SCREAM = temp; - } - temp = null; - try { - temp = Sound.valueOf("ENTITY_ITEM_PICKUP"); - } catch (Exception e) { - temp = Sound.valueOf("ITEM_PICKUP"); - } finally { - ITEM_PICKUP = temp; - } - temp = null; - try { - temp = Sound.valueOf("ENTITY_ITEM_BREAK"); - } catch (Exception e) { - temp = Sound.valueOf("ITEM_BREAK"); - } finally { - ITEM_BREAK = temp; - } - temp = null; - try { - temp = Sound.valueOf("BLOCK_ANVIL_USE"); - } catch (Exception e) { - temp = Sound.valueOf("ANVIL_USE"); - } finally { - ANVIL_USE = temp; - } - temp = null; - try { - temp = Sound.valueOf("BLOCK_ANVIL_LAND"); - } catch (Exception e) { - temp = Sound.valueOf("ANVIL_LAND"); - } finally { - ANVIL_LAND = temp; - } - temp = null; - try { - temp = Sound.valueOf("ENTITY_BAT_TAKEOFF"); - } catch (Exception e) { - temp = Sound.valueOf("BAT_TAKEOFF"); - } finally { - BAT_TAKEOFF = temp; - } - temp = null; - try { - temp = Sound.valueOf("ENTITY_FIREWORK_BLAST_FAR"); - } catch (Exception e) { - temp = Sound.valueOf("FIREWORK_LARGE_BLAST2"); - } finally { - FIREWORK_BLAST_FAR = temp; - } - } - -}