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);
}
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);
}
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);
}
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);
}
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;
}
}
}
Aggregations