Java Code Examples for org.bukkit.enchantments.Enchantment#ARROW_DAMAGE

The following examples show how to use org.bukkit.enchantments.Enchantment#ARROW_DAMAGE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LinfootUtil.java    From CratesPlus with GNU General Public License v3.0 5 votes vote down vote up
public static Enchantment getEnchantmentFromNiceName(String name) {
    Enchantment enchantment = null;
    try {
        enchantment = Enchantment.getByName(name);
    } catch (Exception ignored) {
    }

    if (enchantment != null)
        return enchantment;

    switch (name.toLowerCase()) {
        case "sharpness":
            enchantment = Enchantment.DAMAGE_ALL;
            break;
        case "unbreaking":
            enchantment = Enchantment.DURABILITY;
            break;
        case "efficiency":
            enchantment = Enchantment.DIG_SPEED;
            break;
        case "protection":
            enchantment = Enchantment.PROTECTION_ENVIRONMENTAL;
            break;
        case "power":
            enchantment = Enchantment.ARROW_DAMAGE;
            break;
        case "punch":
            enchantment = Enchantment.ARROW_KNOCKBACK;
            break;
        case "infinite":
            enchantment = Enchantment.ARROW_INFINITE;
            break;
    }

    return enchantment;
}
 
Example 2
Source File: Library.java    From civcraft with GNU General Public License v2.0 4 votes vote down vote up
public static Enchantment getEnchantFromString(String name) {
	
	// Armor Enchantments
	if (name.equalsIgnoreCase("protection")) {
		return Enchantment.PROTECTION_ENVIRONMENTAL;
	}
	if (name.equalsIgnoreCase("fire_protection")) {
		return Enchantment.PROTECTION_FIRE;
	}
	if (name.equalsIgnoreCase("feather_falling")) {
		return Enchantment.PROTECTION_FALL;
	}
	if (name.equalsIgnoreCase("blast_protection")) {
		return Enchantment.PROTECTION_EXPLOSIONS;
	}
	if (name.equalsIgnoreCase("projectile_protection")) {
		return Enchantment.PROTECTION_PROJECTILE;
	}
	if (name.equalsIgnoreCase("respiration")) {
		return Enchantment.OXYGEN;
	}
	if (name.equalsIgnoreCase("aqua_affinity")) {
		return Enchantment.WATER_WORKER;
	}
	
	// Sword Enchantments
	if (name.equalsIgnoreCase("sharpness")) {
		return Enchantment.DAMAGE_ALL;
	}
	if (name.equalsIgnoreCase("smite")) {
		return Enchantment.DAMAGE_UNDEAD;
	}
	if (name.equalsIgnoreCase("bane_of_arthropods")) {
		return Enchantment.DAMAGE_ARTHROPODS;
	}
	if (name.equalsIgnoreCase("knockback")) {
		return Enchantment.KNOCKBACK;
	}
	if (name.equalsIgnoreCase("fire_aspect")) {
		return Enchantment.FIRE_ASPECT;
	}
	if (name.equalsIgnoreCase("looting")) {
		return Enchantment.LOOT_BONUS_MOBS;
	}
	
	// Tool Enchantments
	if (name.equalsIgnoreCase("efficiency")) {
		return Enchantment.DIG_SPEED;
	}
	if (name.equalsIgnoreCase("silk_touch")) {
		return Enchantment.SILK_TOUCH;
	}
	if (name.equalsIgnoreCase("unbreaking")) {
		return Enchantment.DURABILITY;
	}
	if (name.equalsIgnoreCase("fortune")) {
		return Enchantment.LOOT_BONUS_BLOCKS;
	}
	
	// Bow Enchantments
	if (name.equalsIgnoreCase("power")) {
		return Enchantment.ARROW_DAMAGE;
	}
	if (name.equalsIgnoreCase("punch")) {
		return Enchantment.ARROW_KNOCKBACK;
	}
	if (name.equalsIgnoreCase("flame")) {
		return Enchantment.ARROW_FIRE;
	}
	if (name.equalsIgnoreCase("infinity")) {
		return Enchantment.ARROW_INFINITE;
	}
	
	return null;
	
}