Solved Cancel all crafting and guis (Crafting table, inventory, furnace, anvil, etc)

Discussion in 'Plugin Development' started by jumbledProgram, Oct 9, 2020.

  1. Offline

    jumbledProgram

    Hi guys! i'm making a custom bedwars plugin for me and my friends and i dont want anyone to craft anything or open any other guis. I've searched for a while and couldn't find anything that works. Thanks in advance!
     
  2. Offline

    KarimAKL

    @jumbledProgram Listen to the PlayerInteractEvent, and then cancel the event if they clicked an interactable block.
     
    jumbledProgram likes this.
  3. Offline

    jumbledProgram

    Thank you! I'll mark as solved if this works! :)

    Edit: Here's my code if anyone wants it
    Code:
    @EventHandler
        public void Interact(PlayerInteractEvent e) {
            if(e.getAction() == Action.RIGHT_CLICK_BLOCK) {
                if(e.getClickedBlock().getBlockData().getMaterial() == Material.FURNACE) {
                    e.setCancelled(true);
                }
            }
        }
     
     
    Last edited: Oct 9, 2020
  4. Offline

    KarimAKL

Share This Page