Help! Right Click Air

Discussion in 'Plugin Development' started by FurmigaHumana, Jun 18, 2012.

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

    FurmigaHumana

    Code:
         @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false)
        public void onPlayerInteract(PlayerInteractEvent e) {
            Player p = e.getPlayer();
     
            if (e.getAction() == Action.RIGHT_CLICK_AIR) {
                p.sendMessage("AIR");
            }
            if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
                p.sendMessage("BLOCK");
            }
        }
    This is a very simple code but dont work '-'

    I need to know when a player click in the air, like pointing to the sky.
     
  2. Offline

    LexLaiden

    Looks OK. Let me think about this.
     
  3. Offline

    FurmigaHumana

    Code:
            if (e.hasBlock()) {
                p.sendMessage("BLOCK " + e.getClickedBlock().getType());
            } else {
                p.sendMessage("AIR " + e.getClickedBlock().getType());
            }
    dont work. check if e.getClickedBlock() == null also dont works.

    Code:
            if (e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK)
                return;
    dont work.

    I'm out of ideas D:

    //Update
    The problem is just with RIGHT_CLICK_AIR when you dont have nothing in your hands
    RIGHT_CLICK_BLOCK is working fine.
    LEFT_CLICK_BLOCK/AIR is working fine too.

    Problem solved, thanks.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
Thread Status:
Not open for further replies.

Share This Page