BlockExplodeEvent

Discussion in 'Plugin Development' started by new-ewrs728, Oct 11, 2018.

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

    new-ewrs728

    Hey. I have a question, how can I cancel the explosion of a bed in hell? This method does not work ...


    public void BlockExplodeEevent(BlockExplodeEvent e){
    if(e.getBlock() instanceof Bed) {
    e.setCancelled(true);
    }
    }
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    new-ewrs728

    Sorry, but I do not understand why? The class is Listener and there is an @EventHandler
     
  4. Offline

    timtower Administrator Administrator Moderator

    Which are both not visible with the code you posted.
    Did you register the event?
    Did you try to print the materials?
     
  5. Offline

    new-ewrs728

    1. Yes
    2. I tried both the material and the block
     
  6. Offline

    timtower Administrator Administrator Moderator

  7. Offline

    new-ewrs728

    What do you mean "typed"? Bed?
     
  8. Offline

    timtower Administrator Administrator Moderator

  9. Offline

    new-ewrs728

  10. Offline

    timtower Administrator Administrator Moderator

    That you probably need to use it.
    Can't be sure though as I don't know what you are trying to achieve.
     
  11. Offline

    new-ewrs728

    I need if the explosion created a bed in hell, then the event was canceled
     
  12. Offline

    timtower Administrator Administrator Moderator

    Then print the type of the block that explodes.
     
  13. Offline

    new-ewrs728

    AIR XD
     
  14. Offline

    timtower Administrator Administrator Moderator

    Then the bed might not actually be there.
     
  15. Offline

    new-ewrs728

    What kind of nonsense? When I write e.setCancelled (true) in this event, the bed disappears without an explosion. And I need to determine if the bed explodes.
     
  16. Offline

    timtower Administrator Administrator Moderator

    There is also the BlockPlaceEvent, server might cancel that already and then trigger the explosion afterwards.
    And if you cancel the explosion event then the block shouldn't disappear if there are no other events involved.
     
  17. Offline

    new-ewrs728

    I don't need him to disappear, I just want to cancel the explosion of the bed in nether.
     
  18. Offline

    timtower Administrator Administrator Moderator

    But the bed disappears now right? When you forcefully cancel the explosion?
     
  19. Offline

    new-ewrs728

    Yes. Explode Event is responsible for the explosion.
     
  20. Offline

    timtower Administrator Administrator Moderator

    But if you cancel it, does the bed stay?
     
  21. Offline

    new-ewrs728

    No, it will be removed. I just need to cancel the blast if it's a bed.
     
  22. Offline

    timtower Administrator Administrator Moderator

    Then find out what events trigger on that location before the explosion.
     
  23. Offline

    new-ewrs728

    ?
     
  24. Offline

    timtower Administrator Administrator Moderator

    @new-ewrs728 You have the explosion, but something triggers it, probably a blockplaceevent.
    See if it is a bed, look at what happens if you cancel it.
     
  25. Offline

    new-ewrs728

    I need to cancel the blast if the bed caused it. This explosion causes BlockExplodeEvent, why do I need BlockPlaceEvent?
     
  26. Offline

    timtower Administrator Administrator Moderator

    Well, the blockexplodeevemt doesn't tell that it is a bed, so you need to make something to find what was there.
     
  27. Offline

    new-ewrs728

    That is worked XD
    https://pastebin.com/HuUN8tEN
     
  28. Offline

    KarimAKL

    @new-ewrs728 Did you solve the problem or do you still need help?
     
  29. Offline

    new-ewrs728

    Not. The issue has not been resolved. I decided to use InteractEvent, however, when I do a setType (Material.AIR), the bed drops out.
     
Thread Status:
Not open for further replies.

Share This Page