Search in sources :

Example 21 with LocationTag

use of com.denizenscript.denizen.objects.LocationTag 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)

Example 22 with LocationTag

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

the class EntityTeleportScriptEvent method onPlayerTeleports.

@EventHandler
public void onPlayerTeleports(PlayerTeleportEvent event) {
    from = new LocationTag(event.getFrom());
    to = new LocationTag(event.getTo());
    entity = new EntityTag(event.getPlayer());
    cause = event.getCause().name();
    this.event = null;
    pEvent = event;
    fire(event);
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) EntityTag(com.denizenscript.denizen.objects.EntityTag) EventHandler(org.bukkit.event.EventHandler)

Example 23 with LocationTag

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

the class FireworkBurstsScriptEvent method onFireworkBursts.

@EventHandler
public void onFireworkBursts(FireworkExplodeEvent event) {
    entity = new EntityTag(event.getEntity());
    location = new LocationTag(entity.getLocation());
    this.event = event;
    fire(event);
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) EntityTag(com.denizenscript.denizen.objects.EntityTag) EventHandler(org.bukkit.event.EventHandler)

Example 24 with LocationTag

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

the class EntityTargetsScriptEvent method onEntityTargets.

@EventHandler
public void onEntityTargets(EntityTargetEvent event) {
    entity = new EntityTag(event.getEntity());
    reason = new ElementTag(event.getReason().toString());
    target = event.getTarget() != null ? new EntityTag(event.getTarget()) : null;
    location = new LocationTag(event.getEntity().getLocation());
    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 25 with LocationTag

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

the class ProjectileHitsBlockScriptEvent method onProjectileHits.

@EventHandler
public void onProjectileHits(ProjectileHitEvent event) {
    projectile = new EntityTag(event.getEntity());
    if (projectile.getLocation() == null) {
        // No, I can't explain how or why this would ever happen... nonetheless, it appears it does happen sometimes.
        return;
    }
    if (Double.isNaN(projectile.getLocation().getDirection().normalize().getX())) {
        // I can't explain this one either. It also chooses to happen whenever it pleases.
        return;
    }
    Block block = event.getHitBlock();
    if (block == null) {
        return;
    }
    material = new MaterialTag(block);
    shooter = projectile.getShooter();
    location = new LocationTag(block.getLocation());
    this.event = event;
    fire(event);
}
Also used : MaterialTag(com.denizenscript.denizen.objects.MaterialTag) LocationTag(com.denizenscript.denizen.objects.LocationTag) Block(org.bukkit.block.Block) EntityTag(com.denizenscript.denizen.objects.EntityTag) EventHandler(org.bukkit.event.EventHandler)

Aggregations

LocationTag (com.denizenscript.denizen.objects.LocationTag)133 EventHandler (org.bukkit.event.EventHandler)69 EntityTag (com.denizenscript.denizen.objects.EntityTag)45 ElementTag (com.denizenscript.denizencore.objects.core.ElementTag)40 MaterialTag (com.denizenscript.denizen.objects.MaterialTag)33 List (java.util.List)21 ItemTag (com.denizenscript.denizen.objects.ItemTag)18 DurationTag (com.denizenscript.denizencore.objects.core.DurationTag)15 PlayerTag (com.denizenscript.denizen.objects.PlayerTag)14 ListTag (com.denizenscript.denizencore.objects.core.ListTag)13 NPCTag (com.denizenscript.denizen.objects.NPCTag)12 Location (org.bukkit.Location)11 ArrayList (java.util.ArrayList)8 Entity (org.bukkit.entity.Entity)8 FakeBlock (com.denizenscript.denizen.utilities.blocks.FakeBlock)6 InvalidArgumentsException (com.denizenscript.denizencore.exceptions.InvalidArgumentsException)6 Player (org.bukkit.entity.Player)6 Vector (org.bukkit.util.Vector)6 UUID (java.util.UUID)5 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)5