Weird bug on BlockBreakEvent

Discussion in 'Plugin Development' started by BrandonHopkins, Sep 3, 2012.

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

    BrandonHopkins

    So it is a simple as this. When some breaks Iron bars with a Iron pickake or better it drops glowstone and a snow block. I don't know if it is the order I have the code or what but the Id for iron is no where in my code. Anyone have any idea what is going on?

    Code:
    code removed
    
     
  2. instead of just plain id's, try using material.<name>.getId() if you do that it looks nicer
     
  3. Offline

    BrandonHopkins

    I cleaned up the code a bit and gave each of the drops it's own event and I'm still having problems :/
    Code:
    code removed
    Anyone?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  4. Offline

    keensta

    What's the error your gtting?
     
  5. Offline

    BrandonHopkins

    I'm not getting any it's just dropping blocks it shouldn't be.
     
  6. Offline

    nisovin

    Java evaluates && before ||.

    Thus, this line:

    Code:
    id == 257 || id == 278 || id == 285 && event.getBlock().getType() == Material.GLOWSTONE
    is evaluated like this:

    Code:
    id == 257 || id == 278 || (id == 285 && event.getBlock().getType() == Material.GLOWSTONE)
    and not like this:

    Code:
    (id == 257 || id == 278 || id == 285) && event.getBlock().getType() == Material.GLOWSTONE
    See the problem?
     
  7. Offline

    BrandonHopkins

    Thank you very very very much sir :)
     
Thread Status:
Not open for further replies.

Share This Page