Back to strings.

This commit is contained in:
asofold 2014-12-05 12:03:04 +01:00
parent 7b51b1ae43
commit 4aa253df6d

View File

@ -7,14 +7,21 @@ import org.bukkit.inventory.ItemStack;
public final class BridgeEnchant {
private static Enchantment DEPTH_STRIDER = null;
static {
private static final Enchantment parseEnchantment(final String name) {
try {
DEPTH_STRIDER = Enchantment.DEPTH_STRIDER;
} catch (Throwable t) {}
return Enchantment.getByName(name);
} catch (Exception e) {
return null;
}
}
private final static Enchantment DEPTH_STRIDER = parseEnchantment("DEPTH_STRIDER");
/**
*
* @param player
* @return Level of DEPTH_STRIDER capped at 3. Will return 0 if not available.
*/
public static int getDepthStriderLevel(Player player) {
if (DEPTH_STRIDER != null) {
final ItemStack boots = player.getInventory().getBoots();