Events

Discussion in 'Plugin Development' started by Oneric-1st, Feb 15, 2014.

Thread Status:
Not open for further replies.
  1. Hi,
    I've some questions about the Events in Bukkit and I would be happy if you could help me :D

    1) Is it possible to create multiple Methods for the same Event ? Like:
    Code:java
    1. @EventHandler
    2. public void onGeneralBreak(BlockBreakEvent event)
    3. {
    4. //Do something
    5. }
    6.  
    7. @EventHandler
    8. public void onSignBreak(BlockBreakEvent event)
    9. {
    10. if(event.getBlock().getType() == Material.WALL_SIGN )
    11. {
    12. //Do something else
    13. }
    14. }


    2) Is there some sort of "BlockChange" Event, wchich is always called when a block change it's ID ? I could only find Place and Break Events. But that wouldn't include a Id cange done by WorldEdit, is it ?

    Thanks in advance,

    ~Oneric
     
  2. Offline

    TopTobster5

    1) If its just a sign which breaks, just use an if statement to find out if it is that type which is broken.
    2) I don't think so, but I'm not 100% sure.
     
  3. Of course I could just include an if statement, but if it's plenty of code one can better organise it through splitting it up in two or more methods.
     
  4. Offline

    TopTobster5

    Oneric-1st I don't see why it won't work, but my guess would be there may be a couple of bugs where the 2 events would both run. You would be better off using if statements in my opinion.
     
Thread Status:
Not open for further replies.

Share This Page