use of org.bukkit.inventory.meta.ItemMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemLore method adjust.
@Override
public void adjust(Mechanism mechanism) {
if (mechanism.matches("lore")) {
ItemMeta meta = item.getItemStack().getItemMeta();
dList lore = mechanism.getValue().asType(dList.class);
if (item.isItemscript()) {
lore.add(0, ItemScriptHelper.createItemScriptID(item.getScriptName()));
}
for (int i = 0; i < lore.size(); i++) {
lore.set(i, EscapeTags.unEscape(lore.get(i)));
}
meta.setLore(lore);
item.getItemStack().setItemMeta(meta);
}
}
use of org.bukkit.inventory.meta.ItemMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemPatterns method setPatterns.
private void setPatterns(List<Pattern> patterns) {
ItemStack itemStack = item.getItemStack();
ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta instanceof BlockStateMeta) {
Banner banner = (Banner) ((BlockStateMeta) itemMeta).getBlockState();
banner.setPatterns(patterns);
banner.update();
((BlockStateMeta) itemMeta).setBlockState(banner);
} else {
((BannerMeta) itemMeta).setPatterns(patterns);
}
itemStack.setItemMeta(itemMeta);
}
use of org.bukkit.inventory.meta.ItemMeta in project Denizen-For-Bukkit by DenizenScript.
the class InventoryMenuItem method setDescriptions.
public void setDescriptions(String... lines) {
ItemMeta meta = item.getItemMeta();
List<String> lore = new ArrayList<String>();
for (String s : lines) {
lore.addAll(Arrays.asList(Utilities.wrapWords(s, 24)));
}
meta.setLore(lore);
item.setItemMeta(meta);
}
use of org.bukkit.inventory.meta.ItemMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemChangeMessage method sendMessage.
public static void sendMessage(Player player, String message) {
ItemStack item = NMSHandler.getInstance().getEntityHelper().getItemInHand(player);
// which is probably the least intrusive
if (item == null || item.getType() == Material.AIR) {
item = new MaterialData(Material.STAINED_GLASS_PANE, DyeColor.GRAY.getDyeData()).toItemStack();
} else {
item = item.clone();
}
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(message);
item.setItemMeta(meta);
int slot = player.getInventory().getHeldItemSlot() + 36;
NMSHandler.getInstance().getPacketHelper().setSlot(player, slot, item, true);
slotChanged.put(player.getUniqueId(), slot);
}
use of org.bukkit.inventory.meta.ItemMeta in project Minigames by AddstarMC.
the class MenuItem method setItem.
public void setItem(ItemStack item) {
if (item == null) {
Bukkit.getLogger().fine("Item Stack was null on: " + this.getDescription().toString());
return;
}
ItemMeta ometa = displayItem.getItemMeta();
displayItem = item.clone();
ItemMeta nmeta = displayItem.getItemMeta();
nmeta.setDisplayName(ometa.getDisplayName());
nmeta.setLore(nmeta.getLore());
displayItem.setItemMeta(nmeta);
}
Aggregations