Solved PlayerInteractEvent Fire

Discussion in 'Plugin Development' started by 87pen, Nov 10, 2015.

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

    87pen

    Code:
        @EventHandler
        public void onFireClick(PlayerInteractEvent event){
            Player player = (Player)event.getPlayer();
            if(event.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
                if(event.getClickedBlock().getType().equals(Material.FIRE)){
                    player.sendMessage("FireCheckWorks");
                }
            }
        }
    It doesn't send me the debug message, no stack traces. Is there a different way to get the fire block?
     
  2. Offline

    JRL1004

    You can't technically right click fire. You may need to use Player#getTargetBlock() [deprecated] or create a BlockIterator using the player as an argument with a range of 5 (rough estimate of a player's click range) and then iterate through it to see if any of the blocks in the iterator are fire.
     
  3. Offline

    87pen

    Weird, i'll just use a BlockIterator. Thanks.
     
Thread Status:
Not open for further replies.

Share This Page