Solved How can you give player dyes?

Discussion in 'Plugin Development' started by spiroulis, Feb 13, 2014.

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

    spiroulis

    Hey so i noticed that in the material list there arent some items and some of them are the dyes. When you do Material. you can only use RED_ROSE or YELLOW_FLOWER from dyes but i want to use a cuan dye for example. How can i do that?
     
  2. Offline

    desht

    PHP:
    Dye cyan = new Dye();
    cyan.setColor(DyeColor.CYAN);
    player.getInventory().addItem(cyan.toItemStack(amountYouWant));
     
  3. Offline

    spiroulis

    desht oh cool thanks but how can i add a costum lore to them? i used this for every normal item like a blaze rod:
    Code:java
    1. ItemStack blaze1 = new ItemStack(Material.BLAZE_ROD, 1);
    2. ItemMeta blaze1meta = blaze1.getItemMeta();
    3. blaze1meta.setDisplayName(ChatColor.DARK_RED + "Elite 1v1");
    4. ArrayList<String> lore = new ArrayList();
    5. lore.add(ChatColor.RED + "Right click to 1v1 a person with Elite");
    6. blaze1meta.setLore(lore);
    7. blaze1.setItemMeta(blaze1meta);
     
  4. Offline

    desht

    Same way you would for any item stack - via the ItemMeta.
     
  5. Offline

    spiroulis

    desht i tried this but it does not work. I know im doing it the wrong way but heres my code xd :
    Code:java
    1. ItemStack blaze1 = new ItemStack(LightBlue.getItemType(), 1);
    2. ItemMeta blaze1meta = blaze1.getItemMeta();
    3. blaze1meta.setDisplayName(ChatColor.DARK_RED + "Elite 1v1");
    4. ArrayList<String> lore = new ArrayList();
    5. lore.add(ChatColor.RED + "Right click to 1v1 a person with Elite");
    6. blaze1meta.setLore(lore);
    7. blaze1.setItemMeta(blaze1meta);
     
  6. Offline

    desht

    PHP:
    Dye cyan = new Dye();
    cyan.setColor(DyeColor.CYAN);
    ItemStack stack cyan.toItemStack();
    ItemMeta meta stack.getItemMeta();
    meta.setDisplayName(ChatColor.DARK_RED"Elite 1v1");
    meta.setLore(Arrays.asList(ChatColor.RED "Right click to 1v1 a person with Elite");
    stack.setItemMeta(meta);
     
  7. Offline

    spiroulis

    desht Thank you so much :)
     
Thread Status:
Not open for further replies.

Share This Page