Search in sources :

Example 1 with EntityEquipment

use of org.bukkit.inventory.EntityEquipment in project Denizen-For-Bukkit by DenizenScript.

the class PacketHelper_v1_10_R1 method resetEquipment.

@Override
public void resetEquipment(Player player, LivingEntity entity) {
    EntityEquipment equipment = entity.getEquipment();
    showEquipment(player, entity, EquipmentSlot.HAND, equipment.getItemInMainHand());
    showEquipment(player, entity, EquipmentSlot.OFF_HAND, equipment.getItemInOffHand());
    showEquipment(player, entity, EquipmentSlot.HEAD, equipment.getHelmet());
    showEquipment(player, entity, EquipmentSlot.CHEST, equipment.getChestplate());
    showEquipment(player, entity, EquipmentSlot.LEGS, equipment.getLeggings());
    showEquipment(player, entity, EquipmentSlot.FEET, equipment.getBoots());
}
Also used : EntityEquipment(org.bukkit.inventory.EntityEquipment)

Example 2 with EntityEquipment

use of org.bukkit.inventory.EntityEquipment in project Denizen-For-Bukkit by DenizenScript.

the class PlayerEquipsArmorScriptEvent method handleChangedArmor.

private void handleChangedArmor(final Player player, final String reason) {
    EntityEquipment oldEquipment = player.getEquipment();
    final ItemStack oldHelmet = oldEquipment.getHelmet();
    final ItemStack oldChestplate = oldEquipment.getChestplate();
    final ItemStack oldLeggings = oldEquipment.getLeggings();
    final ItemStack oldBoots = oldEquipment.getBoots();
    Bukkit.getScheduler().runTaskLater(DenizenAPI.getCurrentInstance(), new Runnable() {

        @Override
        public void run() {
            EntityEquipment newEquipment = player.getEquipment();
            handleEvent(player, "helmet", oldHelmet, newEquipment.getHelmet(), reason);
            handleEvent(player, "chestplate", oldChestplate, newEquipment.getChestplate(), reason);
            handleEvent(player, "leggings", oldLeggings, newEquipment.getLeggings(), reason);
            handleEvent(player, "boots", oldBoots, newEquipment.getBoots(), reason);
        }
    }, 1);
}
Also used : EntityEquipment(org.bukkit.inventory.EntityEquipment) ItemStack(org.bukkit.inventory.ItemStack)

Example 3 with EntityEquipment

use of org.bukkit.inventory.EntityEquipment in project Denizen-For-Bukkit by DenizenScript.

the class PacketHelper_v1_11_R1 method resetEquipment.

@Override
public void resetEquipment(Player player, LivingEntity entity) {
    EntityEquipment equipment = entity.getEquipment();
    showEquipment(player, entity, EquipmentSlot.HAND, equipment.getItemInMainHand());
    showEquipment(player, entity, EquipmentSlot.OFF_HAND, equipment.getItemInOffHand());
    showEquipment(player, entity, EquipmentSlot.HEAD, equipment.getHelmet());
    showEquipment(player, entity, EquipmentSlot.CHEST, equipment.getChestplate());
    showEquipment(player, entity, EquipmentSlot.LEGS, equipment.getLeggings());
    showEquipment(player, entity, EquipmentSlot.FEET, equipment.getBoots());
}
Also used : EntityEquipment(org.bukkit.inventory.EntityEquipment)

Example 4 with EntityEquipment

use of org.bukkit.inventory.EntityEquipment in project Denizen-For-Bukkit by DenizenScript.

the class PacketHelper_v1_8_R3 method resetEquipment.

@Override
public void resetEquipment(Player player, LivingEntity entity) {
    EntityEquipment equipment = entity.getEquipment();
    showEquipment(player, entity, EquipmentSlot.HAND, equipment.getItemInHand());
    showEquipment(player, entity, EquipmentSlot.HEAD, equipment.getHelmet());
    showEquipment(player, entity, EquipmentSlot.CHEST, equipment.getChestplate());
    showEquipment(player, entity, EquipmentSlot.LEGS, equipment.getLeggings());
    showEquipment(player, entity, EquipmentSlot.FEET, equipment.getBoots());
}
Also used : EntityEquipment(org.bukkit.inventory.EntityEquipment)

Example 5 with EntityEquipment

use of org.bukkit.inventory.EntityEquipment in project Sentinel by mcmonkey4eva.

the class SentinelTrait method isInvisible.

public boolean isInvisible(LivingEntity entity) {
    SentinelCurrentTarget sct = new SentinelCurrentTarget();
    sct.targetID = entity.getUniqueId();
    EntityEquipment eq = entity.getEquipment();
    return entity.hasPotionEffect(PotionEffectType.INVISIBILITY) && !currentTargets.contains(sct) && isAir(eq.getItemInHand()) && isAir(eq.getBoots()) && isAir(eq.getLeggings()) && isAir(eq.getChestplate()) && isAir(eq.getHelmet()) && SentinelPlugin.instance.getConfig().getBoolean("random.ignore invisible targets");
}
Also used : EntityEquipment(org.bukkit.inventory.EntityEquipment)

Aggregations

EntityEquipment (org.bukkit.inventory.EntityEquipment)24 ItemStack (org.bukkit.inventory.ItemStack)13 LivingEntity (org.bukkit.entity.LivingEntity)8 Player (org.bukkit.entity.Player)6 Entity (org.bukkit.entity.Entity)5 ArrayList (java.util.ArrayList)4 Location (org.bukkit.Location)4 Item (org.bukkit.entity.Item)4 Pair (com.mojang.datafixers.util.Pair)3 Mage (com.elmakers.mine.bukkit.api.magic.Mage)2 LinkedList (java.util.LinkedList)2 UUID (java.util.UUID)2 AttributeManager (net.glowstone.entity.AttributeManager)2 GlowLeashHitch (net.glowstone.entity.objects.GlowLeashHitch)2 CompoundTag (net.glowstone.util.nbt.CompoundTag)2 AttributeModifier (org.bukkit.attribute.AttributeModifier)2 LeashHitch (org.bukkit.entity.LeashHitch)2 PlayerInventory (org.bukkit.inventory.PlayerInventory)2 PotionEffect (org.bukkit.potion.PotionEffect)2 PotionEffectType (org.bukkit.potion.PotionEffectType)2