Unable to verify block material in BlockPlaceEvent

Discussion in 'Plugin Development' started by superpetguy1, May 20, 2019.

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

    superpetguy1

    Hello. I'm quite new to the bukkit development scene, but I decided to make a plugin that announces to the server when a TNT block is placed. The BlockPlaceEvent is triggered, but an if statement used to verify that the block is TNT wont.
    Code:
        @EventHandler
        public void onPlace(BlockPlaceEvent event ) {
            Block block = event.getBlock();
            if(block.getState() instanceof TNT) {
                event.getPlayer().getServer().broadcastMessage(event.getPlayer().getDisplayName() + " just placed TNT!");
            }
           
           
        }
     
  2. Offline

    timtower Ninja on the waves Moderator

Thread Status:
Not open for further replies.

Share This Page