Search in sources :

Example 91 with LocationTag

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

the class PlayerTakesFromFurnaceScriptEvent method onPlayerTakesFromFurnace.

@EventHandler
public void onPlayerTakesFromFurnace(FurnaceExtractEvent event) {
    if (EntityTag.isNPC(event.getPlayer())) {
        return;
    }
    item = new ItemTag(event.getItemType(), event.getItemAmount());
    location = new LocationTag(event.getBlock().getLocation());
    this.event = event;
    fire(event);
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) ItemTag(com.denizenscript.denizen.objects.ItemTag) EventHandler(org.bukkit.event.EventHandler)

Example 92 with LocationTag

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

the class ItemSpawnsScriptEvent method onItemSpawns.

@EventHandler
public void onItemSpawns(ItemSpawnEvent event) {
    Item entity = event.getEntity();
    location = new LocationTag(event.getLocation());
    item = new ItemTag(entity.getItemStack());
    this.entity = new EntityTag(entity);
    this.event = event;
    EntityTag.rememberEntity(entity);
    fire(event);
    EntityTag.forgetEntity(entity);
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) Item(org.bukkit.entity.Item) EntityTag(com.denizenscript.denizen.objects.EntityTag) ItemTag(com.denizenscript.denizen.objects.ItemTag) EventHandler(org.bukkit.event.EventHandler)

Example 93 with LocationTag

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

the class NPCOpensScriptEvent method NPCOpenDoor.

@EventHandler
public void NPCOpenDoor(NPCOpenDoorEvent event) {
    npc = new NPCTag(event.getNPC());
    location = new LocationTag(event.getDoor().getLocation());
    fire(event);
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) NPCTag(com.denizenscript.denizen.objects.NPCTag) EventHandler(org.bukkit.event.EventHandler)

Example 94 with LocationTag

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

the class PlayerPlacesHangingScriptEvent method pnPlayerPlacesHanging.

@EventHandler
public void pnPlayerPlacesHanging(HangingPlaceEvent event) {
    if (EntityTag.isNPC(event.getPlayer())) {
        return;
    }
    Entity hangingEntity = event.getEntity();
    EntityTag.rememberEntity(hangingEntity);
    hanging = new EntityTag(hangingEntity);
    location = new LocationTag(event.getBlock().getLocation());
    this.event = event;
    fire(event);
    EntityTag.forgetEntity(hangingEntity);
}
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 95 with LocationTag

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

the class AnchorCommand method execute.

@Override
public void execute(ScriptEntry scriptEntry) {
    Action action = (Action) scriptEntry.getObject("action");
    LocationTag location = scriptEntry.getObjectTag("location");
    ElementTag range = scriptEntry.getElement("range");
    ElementTag id = scriptEntry.getElement("id");
    NPCTag npc = Utilities.getEntryNPC(scriptEntry);
    if (scriptEntry.dbCallShouldDebug()) {
        Debug.report(scriptEntry, getName(), npc, db("action", action.name()), id, location, range);
    }
    Anchors anchors = npc.getCitizen().getOrAddTrait(Anchors.class);
    switch(action) {
        case ADD:
            {
                if (location == null) {
                    Debug.echoError("Must specify a location!");
                    return;
                }
                Anchor existing = anchors.getAnchor(id.asString());
                if (existing != null) {
                    anchors.removeAnchor(existing);
                }
                anchors.addAnchor(id.asString(), location);
                break;
            }
        case REMOVE:
            {
                Anchor n = anchors.getAnchor(id.asString());
                if (n == null) {
                    Debug.echoError(scriptEntry, "Invalid anchor name '" + id.asString() + "'");
                } else {
                    anchors.removeAnchor(n);
                }
                break;
            }
    }
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) Anchors(net.citizensnpcs.trait.Anchors) Anchor(net.citizensnpcs.util.Anchor) NPCTag(com.denizenscript.denizen.objects.NPCTag) ElementTag(com.denizenscript.denizencore.objects.core.ElementTag)

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