Hi,I have a problem, I havean"if"like this : Code: if (p.getItemInHand().getTypeId() == 383) But I wouldspecify onlysheepegg(id383:91). How? Thank you.
You want to retrieve the metadata for item 383. Use this: Code: if (p.getItemInHand().getTypeId() == 383 && ((int) p.getItemInHand().getData()) == 91) { // Blah. }
Why even using getTypeId()? It's a lot easier and maintainable to check item.getType() against a Material. Code:JAVA if(p.getItemInHand().getType() == Material.EGG)// do somethin
w00tklumpWn You can't get the seperate Eggs through Material.MONSTER_EGG I don't think. Not 100% sure.
Thank you guy, but I must put getData().getData() to make it work, i don't now if this is normal. @w00tklumpWn I don't now, I fint it more practice, i get it wrong?
yea, you still have to check the data! Maybe create an seperate Enum for each possible type, just for beeing readable. It's not wrong actually, but uncomfortable! Like i said, you still have to check for the "right" egg type. EDIT by Moderator: merged posts, please use the edit button instead of double posting.