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

@ -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;
}
}
}