Skip to content

KeyInputEvent


This fires each time you press a key.

Cancellable = true

Note

This only applies to keybinds that are set in Minecraft settings.

Parameter

KeyInputEvent

Methods

Key

KeyBinding getKey()

Returns the pressed KeyBinding.

Example

@EventTarget
public void onKeyInput(KeyInputEvent event) {
    if (event.getKey() == mc.gameSettings.keyBindAttack) {
        Meowtils.addMessage("You pressed attack key!");
    }
}