Resolving Specific Dyes for Different events!

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

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

    Mortal_Wombat

    Hello everybody! I made a post about this a bit ago. But the post became somewhat of a train wreck! So here is a new one with a slightly different question!

    When making an event I want to have it where you click a lime green dye and it gives you this effect.

    Or click purple and it gives you this OTHER effect.

    My Code atm

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

    Resolves it as ALL Form of dye.

    So that screws me over so if any of you could help me with this Specific string on getting it to resolve other types of dyes that would be fantastic. Because i know how to spawn it in.

    ItemStack dye = new ItemStack(Material.INK_SACK, 1, (short) 5);


    But that doesnt work for this V_V so please help!

    Thanks in advance!
     
  2. Offline

    Gater12

    Mortal_Wombat
    You can either:
    1. Create your dye ItemStack and compare the one from the player's hand
    Or
    2. getDurability() and compare
     
  3. Offline

    Mortal_Wombat

    How would one go about comparing hands to item stacks lol
     
  4. Offline

    Gater12

    Mortal_Wombat
    getItemInHand returns an ItemStack. You can compare using == or equals(Object o). == is null-safe.
     
Thread Status:
Not open for further replies.

Share This Page