Solved Not setting Lore

Discussion in 'Plugin Development' started by ChintziSecilMC, Jun 26, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    ChintziSecilMC

    I have no idea at all why this isnt working im trying to make it when a player types "/specitems ice" that it applys a set lore to the item they are holding in their hand but its not working D:

    Code:
            Player player = (Player) sender;
            if (args.length == 1 && args[0].equalsIgnoreCase("help")) {
                player.sendMessage(ChatColor.BLUE + "Successfully Running " + ChatColor.AQUA
                        + "Spectacular Items" + ChatColor.GREEN + "version " + ChatColor.AQUA
                        + SpectacularItems.version);
                player.sendMessage(ChatColor.LIGHT_PURPLE + "Powers:");
                player.sendMessage(ChatColor.AQUA + "Ice -" + ChatColor.GREEN + " Shoot ice!");
            } else if (args.length == 1 && args[0].equalsIgnoreCase("ice")) {
                if (player.getItemInHand().getType().equals(Material.AIR)) {
                    player.sendMessage(pluginPrefix + "Can't apply power to air silly xD");
                } else if (player.getItemInHand().getType().equals(Material.STICK)) {
                    List<String> itemLore = new ArrayList<String>();
                    ItemMeta playerItemMeta = player.getItemInHand().getItemMeta();
                    itemLore.add("Blessed with ice powers");
                    playerItemMeta.setLore(itemLore);
                }
            }
     
  2. Offline

    nj2miami

    @ChintziSecilMC

    1. Set the ItemMeta after you set the lore -> getItemInHand().setItemMeta(playerItemMeta)
    2. It only works when you are holding a stick.
     
  3. Offline

    ChintziSecilMC

    @nj2miami Thank you very much :D, it worked
     
    nj2miami likes this.
Thread Status:
Not open for further replies.

Share This Page