Skip to content

Callback: click

Misat11 edited this page May 11, 2020 · 3 revisions

click (Groovy only)

This callback is called when inventory listener couldn't find any action related with clicked item. So unlike the preClick callback, this callback is not fired everytime. This callback is cancellable so you can check, if it's canceled or cancel it. The cancelation will do nothing. Can be used with single item or with all items. These callbacks are called while PostActionEvent is called.

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

   item ('STONE')
   item ('GRAVEL') {
     click {
       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 click can be found here

Clone this wiki locally