I *think* this should be backwards compatible, I may be wrong and it could break both.

This commit is contained in:
t00thpick1 2016-03-01 13:08:11 -05:00
parent 8d16af8770
commit 88b99a3835
16 changed files with 129 additions and 27 deletions

View File

@ -20,6 +20,7 @@ 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<UUID, String> members = new LinkedHashMap<UUID, String>();
@ -227,7 +228,7 @@ public class Party {
leader.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, getLevel()));
if (Config.getInstance().getLevelUpSoundsEnabled()) {
leader.playSound(leader.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
leader.playSound(leader.getLocation(), SoundAdapter.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
}
}
return;

View File

@ -53,6 +53,7 @@ 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.ParticleEffectUtils;
import com.gmail.nossr50.util.skills.PerksUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
@ -504,7 +505,7 @@ public class McMMOPlayer {
}
if (Config.getInstance().getLevelUpSoundsEnabled()) {
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
player.playSound(player.getLocation(), SoundAdapter.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
}
player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(skillType.toString()) + ".Skillup", levelsGained, getSkillLevel(skillType)));

View File

@ -5,7 +5,6 @@ import java.util.List;
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;
@ -33,8 +32,6 @@ 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.runnables.PistonTrackerTask;
import com.gmail.nossr50.runnables.StickyPistonTrackerTask;
import com.gmail.nossr50.skills.alchemy.Alchemy;
import com.gmail.nossr50.skills.excavation.ExcavationManager;
import com.gmail.nossr50.skills.herbalism.Herbalism;
@ -49,6 +46,7 @@ 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;
@ -382,7 +380,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(), Sound.BLOCK_FIRE_EXTINGUISH, Misc.FIZZ_VOLUME, Misc.getFizzPitch());
player.playSound(blockState.getLocation(), SoundAdapter.FIZZ, Misc.FIZZ_VOLUME, Misc.getFizzPitch());
}
}
@ -421,7 +419,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(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
player.playSound(block.getLocation(), SoundAdapter.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)) {
@ -431,7 +429,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(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
player.playSound(blockState.getLocation(), SoundAdapter.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
}
}
}

View File

@ -62,6 +62,7 @@ import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.MobHealthbarUtils;
import com.gmail.nossr50.util.Motd;
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;
@ -325,7 +326,7 @@ public class PlayerListener implements Listener {
event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer));
if (event.isCancelled()) {
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
player.playSound(player.getLocation(), SoundAdapter.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
return;
}
}
@ -336,7 +337,7 @@ public class PlayerListener implements Listener {
event.setCancelled(cancel);
if (pickupSuccess) {
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
player.playSound(player.getLocation(), SoundAdapter.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
player.updateInventory();
return;
}

View File

@ -27,6 +27,7 @@ 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.util.Misc;
import com.gmail.nossr50.util.adapter.SoundAdapter;
import com.gmail.nossr50.util.player.UserManager;
public final class PartyManager {
@ -729,7 +730,7 @@ public final class PartyManager {
member.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, level));
if (levelUpSoundsEnabled) {
member.playSound(member.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
member.playSound(member.getLocation(), SoundAdapter.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
}
}
}

View File

@ -9,6 +9,7 @@ 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 {
@ -23,7 +24,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(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
player.playSound(player.getLocation(), SoundAdapter.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
player.sendMessage(unknown("superskill") + " skill increased by 1. Total (" + unknown("12") + ")");
fireworksShow(player);
}

View File

@ -9,6 +9,7 @@ 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;
@ -86,11 +87,11 @@ public class KrakenAttackTask extends BukkitRunnable {
player.damage(AdvancedConfig.getInstance().getKrakenAttackDamage(), kraken);
if (GLOBAL_EFFECTS) {
world.playSound(playerLocation, Sound.ENTITY_GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
world.playSound(playerLocation, SoundAdapter.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
world.strikeLightningEffect(playerLocation);
}
else {
player.playSound(playerLocation, Sound.ENTITY_GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
player.playSound(playerLocation, SoundAdapter.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
world.createExplosion(playerLocation.getX(), playerLocation.getY(), playerLocation.getZ(), 0F, false, false);
}
}

View File

@ -61,6 +61,7 @@ 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.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
@ -122,7 +123,7 @@ public class FishingManager extends SkillManager {
world.strikeLightningEffect(location);
world.strikeLightningEffect(location);
world.playSound(location, Sound.ENTITY_GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
world.playSound(location, SoundAdapter.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
mcMMO.p.getServer().broadcastMessage(ChatColor.RED + AdvancedConfig.getInstance().getServerUnleashMessage().replace("(PLAYER)", player.getDisplayName()));
}
else {
@ -130,7 +131,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, Sound.ENTITY_GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
player.playSound(location, SoundAdapter.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
}
if (player.getItemInHand().getType() == Material.FISHING_ROD) {

View File

@ -26,6 +26,7 @@ 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;
public class RepairManager extends SkillManager {
@ -51,7 +52,7 @@ public class RepairManager extends SkillManager {
}
if (Config.getInstance().getRepairAnvilPlaceSoundsEnabled()) {
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
player.playSound(player.getLocation(), SoundAdapter.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
}
togglePlacedAnvil();
@ -145,7 +146,7 @@ public class RepairManager extends SkillManager {
// BWONG BWONG BWONG
if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
player.playSound(player.getLocation(), SoundAdapter.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
}
// Repair the item!

View File

@ -23,6 +23,7 @@ import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
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;
public class SalvageManager extends SkillManager {
@ -48,7 +49,7 @@ public class SalvageManager extends SkillManager {
}
if (Config.getInstance().getSalvageAnvilPlaceSoundsEnabled()) {
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
player.playSound(player.getLocation(), SoundAdapter.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
}
togglePlacedAnvil();
@ -112,8 +113,8 @@ public class SalvageManager extends SkillManager {
// BWONG BWONG BWONG - CLUNK!
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);
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.sendMessage(LocaleLoader.getString("Salvage.Skills.Success"));

View File

@ -28,6 +28,7 @@ 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;
@ -89,7 +90,7 @@ public class SmeltingManager extends SkillManager {
blockState.setType(Material.AIR);
if (Config.getInstance().getFluxPickaxeSoundEnabled()) {
player.playSound(blockState.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, Misc.FIZZ_VOLUME, Misc.getFizzPitch());
player.playSound(blockState.getLocation(), SoundAdapter.FIZZ, Misc.FIZZ_VOLUME, Misc.getFizzPitch());
}
ParticleEffectUtils.playFluxEffect(blockState.getLocation());

View File

@ -31,6 +31,7 @@ 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;
@ -333,7 +334,7 @@ public class TamingManager extends SkillManager {
}
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete") + lifeSpan);
player.playSound(location, Sound.ENTITY_FIREWORK_BLAST_FAR, 1F, 0.5F);
player.playSound(location, SoundAdapter.FIREWORK_BLAST_FAR, 1F, 0.5F);
}
private boolean rangeCheck(EntityType type) {

View File

@ -11,6 +11,7 @@ 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;
@ -35,7 +36,7 @@ public class TrackedTamingEntity extends BukkitRunnable {
public void run() {
if (livingEntity.isValid()) {
Location location = livingEntity.getLocation();
location.getWorld().playSound(location, Sound.BLOCK_FIRE_EXTINGUISH, 0.8F, 0.8F);
location.getWorld().playSound(location, SoundAdapter.FIZZ, 0.8F, 0.8F);
ParticleEffectUtils.playCallOfTheWildEffect(livingEntity);
CombatUtils.dealDamage(livingEntity, livingEntity.getMaxHealth(), DamageCause.SUICIDE, livingEntity);
}

View File

@ -18,6 +18,7 @@ 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;
@ -135,7 +136,7 @@ public final class ChimaeraWing {
mcMMOPlayer.setTeleportCommenceLocation(null);
if (Config.getInstance().getChimaeraSoundEnabled()) {
player.playSound(location, Sound.ENTITY_BAT_TAKEOFF, Misc.BAT_VOLUME, Misc.BAT_PITCH);
player.playSound(location, SoundAdapter.BAT_TAKEOFF, Misc.BAT_VOLUME, Misc.BAT_PITCH);
}
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));

View File

@ -21,7 +21,6 @@ import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Sound;
import org.bukkit.Statistic;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
@ -34,6 +33,7 @@ import org.bukkit.inventory.meta.FireworkMeta;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.skills.AprilCommand;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.adapter.SoundAdapter;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
@ -376,7 +376,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(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
player.playSound(player.getLocation(), SoundAdapter.LEVEL_UP, 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())));
}

View File

@ -0,0 +1,91 @@
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;
}
}
}