org.bukkit.enchantments.EnchantmentTarget Java Examples

The following examples show how to use org.bukkit.enchantments.EnchantmentTarget. 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: InteractItemEvent.java    From Hawk with GNU General Public License v3.0 7 votes vote down vote up
@Override
public void postProcess() {
    Material mat = getItemStack().getType();
    boolean gapple = mat == Material.GOLDEN_APPLE;
    if(action == Action.START_USE_ITEM) {
        if((mat.isEdible() && (p.getFoodLevel() < 20 || gapple) && p.getGameMode() != GameMode.CREATIVE) ||
                (mat == Material.POTION && getItemStack().getDurability() == 0) || //water bottles
                (mat == Material.POTION && !Potion.fromItemStack(getItemStack()).isSplash())) {
            pp.setConsumingItem(true);
        }
        if(EnchantmentTarget.WEAPON.includes(mat)) {
            pp.setBlocking(true);
        }
        if(mat == Material.BOW && (p.getInventory().contains(Material.ARROW) || p.getGameMode() == GameMode.CREATIVE)) {
            pp.setPullingBow(true);
        }
    }
    else if(action == Action.RELEASE_USE_ITEM || action == Action.DROP_HELD_ITEM || action == Action.DROP_HELD_ITEM_STACK) {
        pp.setConsumingItem(false);
        pp.setBlocking(false);
        pp.setPullingBow(false);
    }
}
 
Example #2
Source File: CraftEnchantment.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
@Override
public EnchantmentTarget getItemTarget() {
    switch (target.type) {
        case ALL:
            return EnchantmentTarget.ALL;
        case ARMOR:
            return EnchantmentTarget.ARMOR;
        case ARMOR_FEET:
            return EnchantmentTarget.ARMOR_FEET;
        case ARMOR_HEAD:
            return EnchantmentTarget.ARMOR_HEAD;
        case ARMOR_LEGS:
            return EnchantmentTarget.ARMOR_LEGS;
        case ARMOR_CHEST:
            return EnchantmentTarget.ARMOR_TORSO;
        case DIGGER:
            return EnchantmentTarget.TOOL;
        case WEAPON:
            return EnchantmentTarget.WEAPON;
        case BOW:
            return EnchantmentTarget.BOW;
        case FISHING_ROD:
            return EnchantmentTarget.FISHING_ROD;
        case BREAKABLE:
            return EnchantmentTarget.BREAKABLE;
        case WEARABLE:
            return EnchantmentTarget.WEARABLE;
        default:
            return null;
    }
}
 
Example #3
Source File: CraftEnchantment.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
@Override
public EnchantmentTarget getItemTarget() {
    switch (target.type) {
    case all:
        return EnchantmentTarget.ALL;
    case armor:
        return EnchantmentTarget.ARMOR;
    case armor_feet:
        return EnchantmentTarget.ARMOR_FEET;
    case armor_head:
        return EnchantmentTarget.ARMOR_HEAD;
    case armor_legs:
        return EnchantmentTarget.ARMOR_LEGS;
    case armor_torso:
        return EnchantmentTarget.ARMOR_TORSO;
    case digger:
        return EnchantmentTarget.TOOL;
    case weapon:
        return EnchantmentTarget.WEAPON;
    case bow:
        return EnchantmentTarget.BOW;
    case fishing_rod:
        return EnchantmentTarget.FISHING_ROD;
    default:
        return null;
    }
}
 
Example #4
Source File: EnchantingListener.java    From MineTinker with GNU General Public License v3.0 4 votes vote down vote up
@Override
public @NotNull EnchantmentTarget getItemTarget() {
	return EnchantmentTarget.BREAKABLE;
}
 
Example #5
Source File: EnchantmentGlow.java    From NovaGuilds with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EnchantmentTarget getItemTarget() {
	return null;
}
 
Example #6
Source File: GlowEnchantment.java    From ce with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public EnchantmentTarget getItemTarget() {
	return null;
}