I can't seem to add color to this item I am making? Code:java } } else if(cmd.getName().equalsIgnoreCase("weapon")){ if(!(sender instanceof Player)){ sender.sendMessage(ChatColor.YELLOW+"No /Weapon command for you!"); return true; } Player player = (Player)sender; ItemStack weapon = new ItemStack(Material.DIAMOND_SWORD, 1); ItemMeta im = itemstack.getItemMeta(); im.setName(ChatColor.BLUE+"Spade"); itemstack.setItemMeta(im); weapon.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10); weapon.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 100); weapon.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 5); weapon.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, 100); weapon.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, 100); weapon.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 100); }
Firestrike Is the item name working at all? If yes, try setting the item meta after you add the enchantments, I've seen some conflict with them before.
It will now change the name of the item but the lore that a specified won't come up. Code:java } else if(cmd.getName().equalsIgnoreCase("sword")){ if(!(sender instanceof Player)){ sender.sendMessage(ChatColor.YELLOW+"No /Sword command for you!"); return true; } Player player = (Player)sender; ItemStack item = new ItemStack(Material.DIAMOND_SWORD); item.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 5); ItemMeta id = item.getItemMeta(); id.setDisplayName(ChatColor.GOLD+ "Sword of Lightning"); ArrayList<String> lore = new ArrayList<String>(); lore.addAll(id.getLore()); lore.add("This is somthing"); lore.add("This is somthing agian"); id.setLore(lore); item.setItemMeta(id); player.getInventory().addItem(item); player.sendMessage(ChatColor.GOLD+"You just spawned a sword"); }
Code: ItemStack weapon = new ItemStack(Material.DIAMOND_SWORD, 1); ItemMeta im = weapon.getItemMeta(); im.setDisplayName(ChatColor.BLUE+ "Spade"); weapon.setItemMeta(im); weapon.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10); weapon.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 100); weapon.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 5); weapon.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, 100); weapon.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, 100); weapon.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 100);