How to give specific dyes?

Discussion in 'Plugin Development' started by Mortal_Wombat, Jul 22, 2014.

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


    Hello everyone! I am an up and coming Bukkit Developer! I am currently trying to create an even project! But I ran into a problem. No with my code per say. It's just the head Developer wants to use dye's. But when making the event.

    We used (Material.INK_SACK))

    But then arose the problem. How to give other dyes.

    I searched through all the suggestion Eclipse had for Material.
    and nothing.

    So if anyone could help me so as to get all the types of dyes!

    Please and thank you!

  2. Offline


    1. ItemStack item = new ItemStack(Material.INK_SAC, 1, (short) 5);

    That should give you Purple Dye.
  3. Offline


  4. Offline


    I should have been more specific! Lol But i am needing to use it in the strings.

    if (event.getPlayer().getItemInHand().getType().equals(Material.INK_SACK))


    Or some strings that will do the same thing! :D

    And awesome thanks! This will be helpful later on in this project!
  5. Offline


    Mortal_Wombat In this case, don't compare ItemStacks, nor Items. Compare Item Data Values.

    I haven't compared data values in a while, however I believe the line of code is something like this:
    if(p.getInventory().getItemInHand().getDataValue() == item.getDataValue())
  6. "What does that mean, up-and-coming neighborhood?"
    "The realtor didn't think he could move the house saying drug-ravaged battlefield."

    Just reminded me of that line :) Anyway, you should check both the type and the damage to make sure it matches the colour of dye you're looking for.
Thread Status:
Not open for further replies.

Share This Page