[REQ] TNT pre-explosion event? For protection permissions.

Discussion in 'Bukkit Discussion' started by LlmDl, May 5, 2011.

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

    LlmDl

    Hi everyone!

    My request is an event/call/hook to be placed at the moment before a tnt block explodes (not triggered.)

    One of the downfalls of protected areas (specifically Towny) is that by using a TNT cannon to propel the TNT into an area, a player can destroy blocks they wouldn't have permission to destroy.

    By creating a way to check if the person who triggered the TNT (via redstone and manual detonation,) had the permissions to cause an explosion, server admins wouldn't have to nerf TNT completely.

    Bukkit is amazing! Problems of theft, griefing and murder (what made MC SMP frustrating) have all had solutions created. This shouldn't be impossible to do and I hope that the bukkit team can write a solution!
     
  2. Offline

    Raphfrk

    You want something like:

    Code:
        @Override
        public void onEntityExplode(EntityExplodeEvent event) {
    
            List<Block> blocks = event.blockList();
    
            for(Block b : blocks) {
                if(testProtectedBlock(b)) {
                    event.setCancelled(true);
                    return;
                }
            }
    
        }
    
    This cancels any explosion which breaks a protected block.

    The client will still render the explosion, but it will revert after a few seconds.
     
    LlmDl likes this.
  3. Offline

    LlmDl

    This is helpful, I'll point it out to the author of Towny. Thanks!
     
Thread Status:
Not open for further replies.

Share This Page