Solved Checking mined block material

Discussion in 'Plugin Help/Development/Requests' started by 5agent55, Dec 31, 2015.

Thread Status:
Not open for further replies.
  1. Hello i wrote some code to drop xp to player if he mines wood but it doesnt work pls help me. If i remove if() it drops xp after mining any block so it should work :/
    Code:
    if(event.getBlock().getType() == Material.WOOD){
            event.setExpToDrop(3);
            }
    //sorry for bad english
     
  2. Offline

    NiCk_1312

    I'm not the best, just started with java but I'll try and play around with it, but may you send me the whole class file?
     
  3. I uploaded my eclipse project here https://goo.gl/N5b3Fx
    part i'm talking about is in BlockBreak.java :)

    [SOLVED] Material.WOOD is actualy a wooden plank block i used wood id 17 insted of Material and now it works :)

    Code:
    if(event.getBlock().getTypeId() == 17){
            event.setExpToDrop(3);
            }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 31, 2015
  4. Offline

    NiCk_1312

    Alright man no problem :)
     
Thread Status:
Not open for further replies.

Share This Page