No colors and lore?!

Discussion in 'Plugin Development' started by Datdenkikniet, Mar 6, 2014.

Thread Status:
Not open for further replies.
  1. So, I made a JoinEvent and it all works, but the item isn't renaming/getting a lore, can anoye tell me what on earth I am doing wrong?
    the class:
    Code:java
    1. package me.datdenkikniet.events;
    2.  
    3. import java.util.Arrays;
    4.  
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.Material;
    7. import org.bukkit.event.EventHandler;
    8. import org.bukkit.event.Listener;
    9. import org.bukkit.event.player.PlayerJoinEvent;
    10. import org.bukkit.inventory.ItemStack;
    11. import org.bukkit.inventory.meta.ItemMeta;
    12.  
    13. public class Join implements Listener{
    14. @EventHandler
    15. public void join(PlayerJoinEvent e){
    16. if (e.getPlayer().getInventory().getItem(7) == null || e.getPlayer().getInventory().getItem(7).getType() == null || e.getPlayer().getInventory().getItem(7).getType() != Material.EMERALD){
    17. Material material = Material.EMERALD;
    18. int ammount = 1;
    19. String name = ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "Teleportation Rune";
    20.  
    21. ItemStack item = new ItemStack(material, ammount);
    22. ItemMeta itemMeta = item.getItemMeta();
    23. itemMeta.setDisplayName(name);
    24.  
    25. itemMeta.setLore(Arrays.asList(ChatColor.GREEN + "Left Click:" + ChatColor.GRAY + " Teleports to Skyte", ChatColor.GREEN + "Sneak-Left Click:" + ChatColor.GRAY + " Set-home at your current position", ChatColor.GREEN + "Sneak-Right Click:" + ChatColor.GRAY + " Teleport to your home"));
    26.  
    27. item.setItemMeta(itemMeta);
    28. e.getPlayer().getInventory().setItem(7, new ItemStack(Material.AIR));
    29. e.getPlayer().getInventory().setItem(7, item);
    30. }
    31. }
    32. }
     
  2. Datdenkikniet

    It doesn't really care, but you write amount with only one 'm'
     
Thread Status:
Not open for further replies.

Share This Page