Skip to content

mod.bt.BindCheck & mod.bt.BindCheckEvent

tiffit edited this page Jul 23, 2018 · 2 revisions

BindCheck

The BindCheck interface is used to set requirement(s) for whether a keybind should be triggered or not. By default, all keybindings have a Bind Check that always returns true.

ZenMethods

boolean canRun(CheckEvent event); Return true to allow the keybinding to run.


BindCheckEvent

The BindCheckEvent class is used during bind checks to provide relevant information to determine if the keybinding can run or not.

ZenGetters/ZenSetters

Keybind bind; -getter- The keybind to check.

IPlayer player; The player.

ZenMethods

Keybind getBind(); The method version of bind.

IItemStack getHeldStack(@Optional boolean offhand); Returns the IItemStack the player is currently holding.

IPlayer getPlayer(); The method version of player.


Example

var left = mod.bt.Binds.getKeybind("key.left");

left.setBindCheck(function(e as mod.bt.BindCheckEvent){
     return e.getHeldStack().isEmpty;
});

The "left" keybinding will only trigger if the player is not holding anything.

Clone this wiki locally