So what happens in this case?

Discussion in 'Plugin Development' started by thefrooh, Jun 9, 2015.

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

    thefrooh

    I'm creating a basic area guard plugin for the server where some of my friends playing, and I'm currently working with the BlockPlaceEvent. I'm just curious, if there is a TNT already placed, and the player tries to place a redstone torch or redstone block that could ignite the TNT, will the ignition be cancelled when cancelling the block place event (or using breakNaturally), or the ignition will start because that counts as BlockIgniteEvent, or EntityExplosionEvent (because TNT becomes an entity after ignited).
     
  2. Offline

    tuskiomi

  3. Offline

    Zombie_Striker

    @thefrooh
    Why don't you watch the EntititySpawnEvent, check if the entity is PrimedTNT that is in the area you want protected, and if it is in that area, remove it.

    This is such an easy way of check if TNT is spawned. If you want to then replace that TNT, you could get the BlockLocation of the TNT and set the Type to TNT, and just check the surrounding blocks if they are any type of activators.
     
  4. Offline

    Konato_K

    @Zombie_Striker As far as I remember EntitySpawnEvent is only a thing in Spigot, and it also doesn't fire when TNT spawns (unless it does in newer 1.8 versions)
     
  5. Offline

    mine-care

    Check onRedstonePower and onBlockIgnite if the target block is tnt and if so block it :) otherwise you can make it explode but cancel the explosion damage (entityExplodeEvent)
     
Thread Status:
Not open for further replies.

Share This Page