I have this item: Code: List<String> lore = new ArrayList<String>(); ItemStack ticket = new ItemStack(Material.PAPER); ItemMeta t = ticket.getItemMeta(); t.setDisplayName(ChatColor.GREEN+"Lottery Ticket"); lore.add(ChatColor.GRAY+"Iron"); t.setLore(lore); ticket.setItemMeta(t); ShapedRecipe sticket = new ShapedRecipe(ticket).shape(" D ", " R ", " S ").setIngredient('D', Material.IRON_INGOT).setIngredient('R', Material.REDSTONE).setIngredient('S', Material.STICK); getServer().addRecipe(sticket); and i have the code: Code: if (player.getItemInHand().getType() == Material.PAPER) { if(player.getItemInHand().getItemMeta().getLore().equals(ChatColor.AQUA+"Diamond") { j.add(player.getName()); int i = player.getItemInHand().getAmount(); ItemStack n = new ItemStack(Material.PAPER, i - 1); player.setItemInHand(n); player.sendMessage(ChatColor.GREEN + "You have joined the lottery!"); { else { player.sendMessage(ChatColor.RED + "You must put ticket in your hand"); } { You can fix it for me? thank you!
The .getLore() method will return a List<String>, and you are assuming it is returning a single string. Use player.getItemInHand().getItemMeta().getLore().contains(ChatColor.AQUA + "Diamond").
Its work but i have more error with this code Code: if(player.getItemInHand().getItemMeta().getLore().contains(ChatColor.GRAY+"Iron")) { j.add(player.getName()); int i = player.getItemInHand().getAmount(); ItemStack n = new ItemStack(Material.PAPER, i - 1); player.setItemInHand(n); player.sendMessage(ChatColor.GREEN + "You have joined the lottery!"); } If the player do the command with a regular paper have this error: "An interal error occurred while attempting to perfrom this command" how i can fix it?
" if(player.getItemInHand().getItemMeta().getLore().contains(ChatColor.AQUA+"Diamond")) " this the code: http://pastebin.com/07VTKhUz