How to get the dyecolor of clay in onInventoryClick()

Discussion in 'Plugin Development' started by wasabii, Aug 28, 2014.

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

    wasabii

    I want to check in an if statement if the color is red or not. How would I go about doing this?

    Code:java
    1. private ItemStack redClay = new ItemStack(Material.STAINED_CLAY, 1, DyeColor.RED.getData());


    Below is pseudo code of what I want to happen.

    Code:Pseduo Code
    1. if(get current item clicked. redClay.dyecolor == dyecolor.red){
    2. setCancelled(true);
    3. }
     
  2. Offline

    ITaco

    Idk is this would work but you might wanna try this:
    if (redClay.getColor() == RED) {
    //Do your stuff
    }

    I'm no master so it's worth a try, I would try it but I'm on my phone in a car not able to try it sorry. But you can try and if it works then cool :)
     
  3. Offline

    Skionz

    This should work
    Code:
    if(redClay.getData().getData() == DyeColor.RED.getData()) {
      //do stuff
    }
    I tested it by out printing the DyeColor.RED.getData() and it successfully printed 14.
     
  4. Offline

    wasabii

    Thanks so much guys!
     
Thread Status:
Not open for further replies.

Share This Page