use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class PlayerPreparesAnvilCraftScriptEvent method onCraftItem.
@EventHandler
public void onCraftItem(PrepareAnvilEvent event) {
if (event.getInventory().getViewers().isEmpty()) {
return;
}
HumanEntity humanEntity = event.getInventory().getViewers().get(0);
if (EntityTag.isNPC(humanEntity)) {
return;
}
this.event = event;
result = new ItemTag(event.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 EntityFirework method getObjectAttribute.
@Override
public ObjectTag getObjectAttribute(Attribute attribute) {
if (attribute == null) {
return null;
}
// -->
if (attribute.startsWith("firework_item")) {
ItemStack item = new ItemStack(Material.FIREWORK_ROCKET);
item.setItemMeta(((Firework) firework.getBukkitEntity()).getFireworkMeta());
return new ItemTag(item).getObjectAttribute(attribute.fulfill(1));
}
return null;
}
use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class ItemChangeMessage method sendMessage.
public static void sendMessage(Player player, String message) {
ItemStack item = player.getEquipment().getItemInMainHand();
// which is probably the least intrusive
if (item == null || item.getType() == Material.AIR) {
item = new ItemStack(Material.LIGHT_GRAY_STAINED_GLASS_PANE);
} else {
item = item.clone();
}
ItemTag itemTag = new ItemTag(item);
NMSHandler.getItemHelper().setDisplayName(itemTag, message);
int slot = player.getInventory().getHeldItemSlot() + 36;
NMSHandler.getPacketHelper().setSlot(player, slot, item, true);
slotChanged.put(player.getUniqueId(), slot);
}
use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class EntityShootsBowEvent method onEntityShootsBow.
@EventHandler
public void onEntityShootsBow(EntityShootBowEvent event) {
entity = new EntityTag(event.getEntity());
bow = new ItemTag(event.getBow());
Entity projectileEntity = event.getProjectile();
EntityTag.rememberEntity(projectileEntity);
projectile = new EntityTag(projectileEntity);
this.event = event;
fire(event);
EntityTag.forgetEntity(projectileEntity);
}
use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class FireworkBurstsScriptEvent method getContext.
@Override
public ObjectTag getContext(String name) {
switch(name) {
case "entity":
return entity;
case "location":
return location;
case "item":
ItemStack itemStack = new ItemStack(Material.FIREWORK_ROCKET);
itemStack.setItemMeta(event.getEntity().getFireworkMeta());
return new ItemTag(itemStack);
}
return super.getContext(name);
}
Aggregations