Search in sources :

Example 66 with LocationTag

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

the class EntityBoundingBox method adjust.

@Override
public void adjust(Mechanism mechanism) {
    // -->
    if (mechanism.matches("bounding_box") && mechanism.requireObject(ListTag.class)) {
        if (entity.isCitizensNPC()) {
            // TODO: Allow editing NPC boxes properly?
            return;
        }
        List<LocationTag> locations = mechanism.valueAsType(ListTag.class).filter(LocationTag.class, mechanism.context);
        if (locations.size() == 2) {
            BoundingBox boundingBox = new BoundingBox(locations.get(0).toVector(), locations.get(1).toVector());
            NMSHandler.getEntityHelper().setBoundingBox(entity.getBukkitEntity(), boundingBox);
            modifiedBoxes.add(entity.getUUID());
        } else {
            mechanism.echoError("Must specify exactly 2 LocationTags in the format '<low>|<high>'!");
        }
    }
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) BoundingBox(com.denizenscript.denizen.nms.util.BoundingBox) ListTag(com.denizenscript.denizencore.objects.core.ListTag)

Example 67 with LocationTag

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

the class BlockFadesScriptEvent method onBlockFades.

@EventHandler
public void onBlockFades(BlockFadeEvent event) {
    location = new LocationTag(event.getBlock().getLocation());
    material = new MaterialTag(event.getBlock());
    this.event = event;
    fire(event);
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) MaterialTag(com.denizenscript.denizen.objects.MaterialTag) EventHandler(org.bukkit.event.EventHandler)

Example 68 with LocationTag

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

the class TNTPrimesScriptEvent method tntPrimeEvent.

@EventHandler
public void tntPrimeEvent(TNTPrimeEvent event) {
    this.event = event;
    location = new LocationTag(event.getBlock().getLocation());
    fire(event);
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) EventHandler(org.bukkit.event.EventHandler)

Example 69 with LocationTag

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

the class BellRingScriptEvent method bellRingEvent.

@EventHandler
public void bellRingEvent(BellRingEvent event) {
    this.event = event;
    location = new LocationTag(event.getBlock().getLocation());
    fire(event);
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) EventHandler(org.bukkit.event.EventHandler)

Example 70 with LocationTag

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

the class EntityAddToWorldScriptEvent method onPreCreatureSpawn.

@EventHandler
public void onPreCreatureSpawn(EntityAddToWorldEvent event) {
    this.entity = new EntityTag(event.getEntity());
    this.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) 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