BlockBreakEvent not detect blocks protected by worldguard

Discussion in 'Plugin Development' started by CONBlaze, Jun 21, 2019.

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

    CONBlaze

    Hello, I wanted to make a plugin that detects when blocks are being broken but it also notifies me about blocks broken in spawn, which is protected by worldguard against breaking! Is there a way to only detect blocks that have been broken successfully? I don't want to manually check the block's coordinates to be outside of spawn!
     
  2. Online

    timtower Administrator Administrator Moderator

    @CONBlaze Use a low eventpriority and check if it is cancelled.
     
  3. Offline

    CONBlaze

    It is not, unfortunately

    Code:
    @EventHandler(priority = EventPriority.LOWEST)
        public void onBlockBreak(BlockBreakEvent event){
        }
    I am not sure I did it the right way, though.
     
  4. Online

    timtower Administrator Administrator Moderator

  5. Offline

    CONBlaze

    Sorry forgot to include it in the snipet above, but I did add it and it doesn't work
    Code:
    public void onBlockBreak(BlockBreakEvent event){
            if (event.isCancelled()) return;
    }
    Sorry about that :/
     
    Last edited: Jun 21, 2019
  6. Online

    timtower Administrator Administrator Moderator

  7. Offline

    CONBlaze

    timtower likes this.
Thread Status:
Not open for further replies.

Share This Page