preventing inventory movement?

Discussion in 'Spigot Plugin Development' started by flogic, Jul 3, 2015.

  1. Hello I am currently writing a bukkit plugin that has to do with inventory GUIs,

    Code (Text):
        @EventHandler
        public void cancelClick(InventoryClickEvent ev)
        {
            ev.setCancelled(true);
        }
    however this code does nothing, I've tried different ifs and such, but the players can still move the item around.

    also I get no errors in console
     
  2. Did you register the event listener? Try adding a logger statement at the beginning of your listener method to ensure that the method is being called.
     
  3. Look up InventoryAction. Use a switch statement and cancel all the actions that you don't want happening.
     
  4. ... I feel really dumb now .-. but thanks for the help.