Solved Weird event not firing?

Discussion in 'Spigot Plugin Development' started by Waldxn, Jun 5, 2017.

  1. Hey when using this code: It is working when right clicking a block, but not when right clicking air. Any idea why?

    Code (Text):
        public void guiClick(PlayerInteractEvent event) {

            if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
                Player player = event.getPlayer();
                Inventory inv = Bukkit.createInventory(player, 27, ChatColor.RED + "Test INVVV");
                for (int i = 0; i < inv.getSize(); i++) {
                    inv.setItem(i, wood);
  2. try outputting the PlayerInteractEvent#getAction when right-clicking the air and see what is being outputted.
  3. I added a sysout and it isn't printing anything unless I right click a block. It does fire when left clicking the air however.
  4. yep, i dont believe the client responds to this (sends packets whenever right clicking air without item in hand)
  5. Oh right. Ok thanks for the answer. Didn't think about the item in hand.