use of org.bukkit.inventory.meta.ItemMeta in project TangledMazes by GorgeousOne.
the class TangledMain method isSelectionWand.
public static boolean isSelectionWand(ItemStack item) {
if (item == null)
return false;
ItemMeta itemMeta = item.getItemMeta();
ItemMeta wandmeta = wand.getItemMeta();
return item.getType() == wand.getType() && itemMeta.getDisplayName() != null && itemMeta.getDisplayName().equals(wandmeta.getDisplayName());
}
use of org.bukkit.inventory.meta.ItemMeta in project Ublisk by Derkades.
the class UpdateBackpackName method run.
@Override
public void run() {
// TODO Remove this when a new system is in place
for (Player player : Bukkit.getOnlinePlayers()) {
PlayerInventory inv = player.getInventory();
if (inv.getItemInMainHand().getType() == Material.END_CRYSTAL) {
inv.remove(Material.END_CRYSTAL);
ItemStack item = new ItemStack(Material.END_CRYSTAL);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.BLUE + "" + ChatColor.BOLD + "Backpack");
item.setItemMeta(meta);
int slot = inv.getHeldItemSlot();
inv.setItem(slot, item);
}
}
}
use of org.bukkit.inventory.meta.ItemMeta in project Ublisk by Derkades.
the class Item method setName.
public Item setName(String name) {
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(name);
item.setItemMeta(meta);
return this;
}
use of org.bukkit.inventory.meta.ItemMeta in project Fusion by GummyPvP.
the class ItemBuilder method lore.
/**
* Set the lore of an ItemStack.
*
* @param lore - List(String) - lines of text to add to the ItemStack's lore.
* @return current instance of ItemBuilder object.
*/
public ItemBuilder lore(List<String> lore) {
ItemMeta im = item.getItemMeta();
List<String> clone = new ArrayList<String>();
for (String lores : lore) {
clone.add(ChatColor.translateAlternateColorCodes('&', lores));
}
im.setLore(clone);
item.setItemMeta(im);
return this;
}
use of org.bukkit.inventory.meta.ItemMeta in project modules-extra by CubeEngine.
the class LogCommands method giveSelectionTool.
@SuppressWarnings("deprecation")
public static void giveSelectionTool(User user) {
ItemStack found = null;
for (ItemStack item : user.getInventory().getContents()) {
if (item != null && item.getType() == WOOD_AXE && item.hasItemMeta() && item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().equals(selectorToolName)) {
found = item;
break;
}
}
if (found == null) {
found = new ItemStack(WOOD_AXE, 1);
ItemMeta meta = found.getItemMeta();
meta.setDisplayName(selectorToolName);
meta.setLore(Arrays.asList("created by " + user.getDisplayName()));
found.setItemMeta(meta);
ItemStack oldItemInHand = user.getItemInHand();
user.setItemInHand(found);
HashMap<Integer, ItemStack> tooMuch = user.getInventory().addItem(oldItemInHand);
for (ItemStack item : tooMuch.values()) {
user.getWorld().dropItemNaturally(user.getLocation(), item);
}
user.updateInventory();
user.sendTranslated(POSITIVE, "Received a new Region-Selector Tool");
return;
}
user.getInventory().removeItem(found);
ItemStack oldItemInHand = user.getItemInHand();
user.setItemInHand(found);
user.getInventory().addItem(oldItemInHand);
user.updateInventory();
user.sendTranslated(POSITIVE, "Found a Region-Selector Tool in your inventory!");
}
Aggregations