Skip to content

Callback: preClick

Misat11 edited this page May 11, 2020 · 4 revisions

preClick (Groovy only)

This callback is called when InventoryListener starts processing an item click. This callback is cancellable so you can check, if it's canceled or cancel it. When it's canceled, the inventory will just close. Can be used with single item or with all items. These callbacks are called while PreActionEvent is called.

inventory {
   preClick {
     player.sendMessage 'This message you will see when any item or any slot is clicked!'
   }

   item ('STONE')
   item ('GRAVEL') {
     preClick {
       player.sendMessage 'This message you will see just when this specific gravel is clicked'
     }

     /* Items inside category won't be affected with parent's callbacks */
     item('DIRT')
   }
}

All methods available inside preClick can be found here

Clone this wiki locally