use of com.elmakers.mine.bukkit.magic.MageTrigger in project MagicPlugin by elBukkit.
the class EntityMageData method tick.
public void tick(Mage mage) {
List<MageTrigger> intervalTriggers = getTriggers(MageTriggerType.INTERVAL);
if (intervalTriggers == null)
return;
Entity entity = mage.getLivingEntity();
Creature creature = (entity instanceof Creature) ? (Creature) entity : null;
if (requiresTarget && (creature == null || creature.getTarget() == null))
return;
if (requiresWand != null && entity instanceof LivingEntity) {
LivingEntity li = (LivingEntity) entity;
ItemStack itemInHand = li.getEquipment().getItemInMainHand();
if (itemInHand == null || itemInHand.getType() != requiresWand.getType())
return;
}
for (MageTrigger trigger : intervalTriggers) {
trigger.execute(mage);
}
}
Aggregations