use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class PlayerItemTakesDamageScriptEvent method onPlayerItemTakesDamage.
@EventHandler
public void onPlayerItemTakesDamage(PlayerItemDamageEvent event) {
if (EntityTag.isNPC(event.getPlayer())) {
return;
}
item = new ItemTag(event.getItem());
location = new LocationTag(event.getPlayer().getLocation());
this.event = event;
fire(event);
}
use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class PlayerCraftsItemScriptEvent method onCraftItem.
@EventHandler
public void onCraftItem(CraftItemEvent event) {
// This event fires even when nothing crafts due to a cursor item, so disregard those cases.
if (event.getClick() != ClickType.SHIFT_LEFT && event.getCursor() != null && event.getCursor().getType() != Material.AIR) {
if (!event.getCursor().isSimilar(event.getCurrentItem())) {
return;
}
if (event.getCursor().getAmount() + event.getRecipe().getResult().getAmount() > event.getCursor().getType().getMaxStackSize()) {
return;
}
}
HumanEntity humanEntity = event.getWhoClicked();
if (EntityTag.isNPC(humanEntity)) {
return;
}
this.event = event;
result = new ItemTag(event.getInventory().getResult());
if (result.getBukkitMaterial() == Material.AIR) {
result = new ItemTag(event.getRecipe().getResult());
}
this.player = EntityTag.getPlayerFrom(humanEntity);
this.cancelled = false;
fire(event);
}
use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class PlayerDragsInInvScriptEvent method onPlayerDragsInInv.
@EventHandler
public void onPlayerDragsInInv(InventoryDragEvent event) {
if (EntityTag.isCitizensNPC(event.getWhoClicked())) {
return;
}
entity = EntityTag.getPlayerFrom(event.getWhoClicked());
inventory = event.getInventory();
dInv = InventoryTag.mirrorBukkitInventory(inventory);
item = new ItemTag(event.getOldCursor());
this.event = event;
fire(event);
}
use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class ItemDespawnsScriptEvent method onItemDespawns.
@EventHandler
public void onItemDespawns(ItemDespawnEvent event) {
location = new LocationTag(event.getLocation());
item = new ItemTag(event.getEntity().getItemStack());
entity = new EntityTag(event.getEntity());
this.event = event;
fire(event);
}
use of com.denizenscript.denizen.objects.ItemTag 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);
}
Aggregations