use of com.denizenscript.denizen.objects.NPCTag in project Denizen-For-Bukkit by DenizenScript.
the class SittingTrait method sit.
// <--[action]
// @Actions
// sit
//
// @Triggers when the NPC sits down.
//
// @Context
// None
//
// -->
/**
* Makes the NPC sit
*/
public void sit() {
if (!npc.isSpawned()) {
return;
}
new NPCTag(npc).action("sit", null);
sit(npc.getStoredLocation());
}
use of com.denizenscript.denizen.objects.NPCTag in project Denizen-For-Bukkit by DenizenScript.
the class SneakingTrait method sneak.
// <--[action]
// @Actions
// sneak
//
// @Triggers when the NPC starts sneaking.
//
// @Context
// None
//
// -->
/**
* Makes the NPC sneak
*/
public void sneak() {
new NPCTag(npc).action("sneak", null);
if (npc.getEntity().getType() != EntityType.PLAYER) {
return;
}
NMSHandler.getEntityHelper().setSneaking(npc.getEntity(), true);
sneaking = true;
}
use of com.denizenscript.denizen.objects.NPCTag in project Denizen-For-Bukkit by DenizenScript.
the class SneakingTrait method stand.
/**
* Makes the NPC stand
*/
public void stand() {
// Notated in SittingTrait
new NPCTag(npc).action("stand", null);
NMSHandler.getEntityHelper().setSneaking(npc.getEntity(), false);
sneaking = false;
}
use of com.denizenscript.denizen.objects.NPCTag in project Denizen-For-Bukkit by DenizenScript.
the class DenizenNPCHelper method onInventoryClick.
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Inventory inventory = event.getInventory();
if (inventory.getHolder() instanceof NPCTag) {
NPCTag npc = (NPCTag) inventory.getHolder();
npc.getInventory().setContents(inventory.getContents());
Equipment equipment = npc.getEquipmentTrait();
for (int i = 0; i < 5; i++) {
equipment.set(i, inventory.getItem(i));
}
}
}
use of com.denizenscript.denizen.objects.NPCTag in project Denizen-For-Bukkit by DenizenScript.
the class DenizenNPCHelper method despawn.
// <--[action]
// @Actions
// despawn
// @Triggers when the NPC is despawned.
// This can be because a command was issued, or a chunk has been unloaded.
//
// @Context
// None
// -->
/**
* Fires a world script event and then NPC action when the NPC despawns.
*
* @param event NPCDespawnEvent
*/
@EventHandler
public void despawn(NPCDespawnEvent event) {
NPCTag npc = new NPCTag(event.getNPC());
if (npc.isValid()) {
EntityDespawnScriptEvent.instance.entity = new EntityTag(event.getNPC().getEntity());
EntityDespawnScriptEvent.instance.cause = new ElementTag("CITIZENS");
EntityDespawnScriptEvent.instance.fire(event);
npc.action("despawn", null);
}
}
Aggregations