check wool type in inventory

Discussion in 'Plugin Development' started by karolis11234, Aug 18, 2014.

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

    karolis11234

    im trying to check if a player has colored wool but i only know how i can check for normal(white) wool .the part of my code that gets if its wool:
    if(inv.contains(Material.WOOL, 10)) {
    it checks if its wool but i dont know how i can check for its color. can anybody help ?
     
  2. Offline

    moe097

    Try the "DyeColor.YOURCOLOR" method.
     
  3. Offline

    AoH_Ruthless

    karolis11234
    Define the ItemStack first.
    Code:java
    1. ItemStack stack = new ItemStack(Material.WOOL, (byte) 3, 10); // 10 wool with metadata 3.


    Then, use your contains if-check:
    Code:java
    1. if (inv.contains(stack) { /* code */ }
     
  4. Offline

    karolis11234

    doesnt work it throws me and error when compiling(using eclipse) and its also underlined red.
     
  5. Offline

    Necrodoom

  6. Offline

    karolis11234

    when i hover over this place new ItemStack(Material.WOOL, (byte) 3, 10); it gives me the error:
    The constructor ItemStack(Material, byte, int) is undefined
     
  7. karolis11234 Yeah its the other way around
    Code:java
    1. ItemStack is = new ItemStack(Material.WOOL, 10, (byte) 3);


    3 is the color data
     
Thread Status:
Not open for further replies.

Share This Page