Search in sources :

Example 21 with EntityTag

use of com.denizenscript.denizen.objects.EntityTag in project Denizen-For-Bukkit by DenizenScript.

the class EntityAirLevelChangeScriptEvent method onEntityAirLevelChanged.

@EventHandler
public void onEntityAirLevelChanged(EntityAirChangeEvent event) {
    entity = new EntityTag(event.getEntity());
    this.event = event;
    fire(event);
}
Also used : EntityTag(com.denizenscript.denizen.objects.EntityTag) EventHandler(org.bukkit.event.EventHandler)

Example 22 with EntityTag

use of com.denizenscript.denizen.objects.EntityTag in project Denizen-For-Bukkit by DenizenScript.

the class EntityBreaksHangingScriptEvent method onHangingBreaks.

@EventHandler
public void onHangingBreaks(HangingBreakByEntityEvent event) {
    hanging = new EntityTag(event.getEntity());
    cause = new ElementTag(event.getCause().name());
    location = new LocationTag(hanging.getLocation());
    breaker = new EntityTag(event.getRemover());
    this.event = event;
    fire(event);
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) EntityTag(com.denizenscript.denizen.objects.EntityTag) ElementTag(com.denizenscript.denizencore.objects.core.ElementTag) EventHandler(org.bukkit.event.EventHandler)

Example 23 with EntityTag

use of com.denizenscript.denizen.objects.EntityTag in project Denizen-For-Bukkit by DenizenScript.

the class EntityDamagedScriptEvent method onEntityDamaged.

@EventHandler
public void onEntityDamaged(EntityDamageEvent event) {
    entity = new EntityTag(event.getEntity());
    cause = new ElementTag(CoreUtilities.toLowerCase(event.getCause().name()));
    damager = null;
    projectile = null;
    held = null;
    if (event instanceof EntityDamageByEntityEvent) {
        damager = new EntityTag(((EntityDamageByEntityEvent) event).getDamager());
        if (damager.isProjectile()) {
            projectile = damager;
            if (damager.hasShooter()) {
                damager = damager.getShooter();
            }
        }
        if (damager != null) {
            held = damager.getItemInHand();
            if (held != null) {
                held.setAmount(1);
            }
        }
    }
    this.event = event;
    fire(event);
}
Also used : EntityDamageByEntityEvent(org.bukkit.event.entity.EntityDamageByEntityEvent) EntityTag(com.denizenscript.denizen.objects.EntityTag) ElementTag(com.denizenscript.denizencore.objects.core.ElementTag) EventHandler(org.bukkit.event.EventHandler)

Example 24 with EntityTag

use of com.denizenscript.denizen.objects.EntityTag in project Denizen-For-Bukkit by DenizenScript.

the class EntityFoodLevelChangeScriptEvent method onEntityFoodLevelChanged.

@EventHandler
public void onEntityFoodLevelChanged(FoodLevelChangeEvent event) {
    entity = new EntityTag(event.getEntity());
    this.event = event;
    fire(event);
}
Also used : EntityTag(com.denizenscript.denizen.objects.EntityTag) EventHandler(org.bukkit.event.EventHandler)

Example 25 with EntityTag

use of com.denizenscript.denizen.objects.EntityTag in project Denizen-For-Bukkit by DenizenScript.

the class EntitySpawnerSpawnScriptEvent method onSpawnerSpawn.

@EventHandler
public void onSpawnerSpawn(SpawnerSpawnEvent event) {
    Entity entity = event.getEntity();
    this.entity = new EntityTag(entity);
    location = new LocationTag(event.getLocation());
    spawnerLocation = new LocationTag(event.getSpawner().getLocation());
    this.event = event;
    EntityTag.rememberEntity(entity);
    fire(event);
    EntityTag.forgetEntity(entity);
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) Entity(org.bukkit.entity.Entity) EntityTag(com.denizenscript.denizen.objects.EntityTag) EventHandler(org.bukkit.event.EventHandler)

Aggregations

EntityTag (com.denizenscript.denizen.objects.EntityTag)142 EventHandler (org.bukkit.event.EventHandler)81 ElementTag (com.denizenscript.denizencore.objects.core.ElementTag)56 LocationTag (com.denizenscript.denizen.objects.LocationTag)45 List (java.util.List)27 Entity (org.bukkit.entity.Entity)25 ItemTag (com.denizenscript.denizen.objects.ItemTag)17 ListTag (com.denizenscript.denizencore.objects.core.ListTag)17 PlayerTag (com.denizenscript.denizen.objects.PlayerTag)15 InvalidArgumentsException (com.denizenscript.denizencore.exceptions.InvalidArgumentsException)12 DurationTag (com.denizenscript.denizencore.objects.core.DurationTag)11 NPCTag (com.denizenscript.denizen.objects.NPCTag)10 ArrayList (java.util.ArrayList)10 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)10 ScriptEntry (com.denizenscript.denizencore.scripts.ScriptEntry)9 Player (org.bukkit.entity.Player)9 MaterialTag (com.denizenscript.denizen.objects.MaterialTag)8 Argument (com.denizenscript.denizencore.objects.Argument)8 LivingEntity (org.bukkit.entity.LivingEntity)8 Item (org.bukkit.entity.Item)7