use of org.bukkit.inventory.meta.ItemMeta in project TotalFreedomMod by TotalFreedom.
the class Command_cake method run.
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
final StringBuilder output = new StringBuilder();
final String[] words = CAKE_LYRICS.split(" ");
for (final String word : words) {
output.append(ChatColor.COLOR_CHAR).append(Integer.toHexString(1 + random.nextInt(14))).append(word).append(" ");
}
final ItemStack heldItem = new ItemStack(Material.CAKE);
final ItemMeta heldItemMeta = heldItem.getItemMeta();
heldItemMeta.setDisplayName((new StringBuilder()).append(ChatColor.WHITE).append("The ").append(ChatColor.DARK_GRAY).append("Lie").toString());
heldItem.setItemMeta(heldItemMeta);
for (final Player player : server.getOnlinePlayers()) {
final int firstEmpty = player.getInventory().firstEmpty();
if (firstEmpty >= 0) {
player.getInventory().setItem(firstEmpty, heldItem);
}
player.awardAchievement(Achievement.BAKE_CAKE);
}
FUtil.bcastMsg(output.toString());
return true;
}
use of org.bukkit.inventory.meta.ItemMeta in project GameCore by Warvale.
the class ClassSelect method openGUI.
private void openGUI(Player player) {
inv = Bukkit.createInventory(null, 45, ChatColor.DARK_GRAY + "Select a class: ");
Integer inventoryIndex = 0;
for (Map.Entry<String, Class> clazzSet : ClassManager.classes.entrySet()) {
Class clazz = clazzSet.getValue();
ItemStack classStack = clazz.getItem();
ItemMeta classMeta = classStack.getItemMeta();
List<String> desc = new LinkedList<>(clazz.getDescription());
desc.add(0, ChatColor.translateAlternateColorCodes('&', "&7PRICE: &e" + clazz.getPrice()));
desc.add(1, ChatColor.GRAY + "ABILITY: " + ChatColor.YELLOW + clazz.getAbility());
classMeta.setLore(desc);
classMeta.setDisplayName(ChatColor.AQUA + clazz.getName());
classStack.setItemMeta(classMeta);
inv.setItem(inventoryIndex, classStack);
slots.put(inventoryIndex, clazz);
inventoryIndex = inventoryIndex + 1;
}
player.openInventory(inv);
}
use of org.bukkit.inventory.meta.ItemMeta in project GameCore by Warvale.
the class TeamSelect method tsGUI.
private void tsGUI(Player player) {
inv = Bukkit.createInventory(null, 9, ChatColor.DARK_GRAY + "Select a team:");
Wool wool_red = new Wool(DyeColor.RED);
ItemStack itemtsred = wool_red.toItemStack(1);
ItemMeta itemtsredmeta = itemtsred.getItemMeta();
itemtsredmeta.setDisplayName(ChatColor.RED + "Red");
itemtsred.setItemMeta(itemtsredmeta);
Wool wool_cyan = new Wool(DyeColor.CYAN);
ItemStack itemtscyan = wool_cyan.toItemStack(1);
ItemMeta itemtscyanmeta = itemtscyan.getItemMeta();
itemtscyanmeta.setDisplayName(ChatColor.DARK_AQUA + "Blue");
itemtscyan.setItemMeta(itemtscyanmeta);
ItemStack closemenu = new ItemStack(Material.BARRIER, 1);
ItemMeta closemenumeta = closemenu.getItemMeta();
closemenumeta.setDisplayName(ChatColor.DARK_RED + "Close selector");
closemenu.setItemMeta(closemenumeta);
inv.setItem(3, itemtsred);
inv.setItem(4, closemenu);
inv.setItem(5, itemtscyan);
player.openInventory(inv);
}
use of org.bukkit.inventory.meta.ItemMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemDisplayname method adjust.
@Override
public void adjust(Mechanism mechanism) {
if (mechanism.matches("display_name")) {
ItemMeta meta = item.getItemStack().getItemMeta();
meta.setDisplayName(EscapeTags.unEscape(mechanism.getValue().asString()));
item.getItemStack().setItemMeta(meta);
}
}
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);
}
}
Aggregations