InputTracker
Overview
InputTracker turns the keyboard and the inventory into triggers for TypeWriter. It listens to a handful of player inputs (swap hand, drop, sneak, sprint, chat, commands and hotbar selection) and runs the actions you choose. It can also pin buttons in the player's inventory or in the 2x2 crafting grid: items that cannot be moved, dropped or placed, and that run actions when clicked.
Everything is configured in one manifest entry, Input Trigger Config. It is useful for RPG-style shortcuts, for example opening a menu with the F key, or giving every player a "Menu" clock in the last hotbar slot.
Features
- Seven inputs — swap hand (F), drop (Q), sneak (Shift), sprint (Ctrl), chat message, command, and hotbar slot selection.
- Cancel the original action — optionally stop the vanilla behaviour, for example keep the F key from swapping items.
- Criteria, delay and cooldown — only run when conditions match, after a delay in ticks, with a cooldown between two triggers.
- Inventory buttons — items pinned to chosen slots that cannot be moved, dropped, placed or eaten.
- Click types — a different set of actions for left, right, shift-left, shift-right, drop, double click, or any click as a fallback.
- Hotbar buttons in the world — left and right clicks with a button in hand run its actions.
- Crafting grid buttons — buttons in the 2x2 crafting grid, with crafting disabled while a button sits in it.
- Per-button criteria — each button, and each click binding, can have its own conditions.
Installation
- Use Paper 1.21 or later. No packet library is needed.
- Put the InputTracker JAR in
plugins/Typewriter/extensions/and restart the server.
The extension schedules delays with the Bukkit scheduler, so it is meant for Paper and not for Folia.
Getting started
Open a menu when the player presses F, and give every player a menu button:
- In the TypeWriter web panel, open a manifest page and add an Input Trigger Config entry. Create only one: the first one found is used.
- In
keybinds, add an item. SettypetoSWAP_HAND, tickenabled(it is off by default), and tickcancelActionso the hands are not swapped. - In its
actions, select the action entry that opens your menu. Setcooldownto10ticks to avoid double triggers. - In
inventoryButtons, add an item. Setslotto8(the last hotbar slot) and choose theitemto show, for example a clock named<gold>Menu. - In its
clickActions, add a binding withclickTypeLEFTand the same action inactions. - Publish. Players receive the button when they join or respawn.
A button replaces whatever item is in its slot. Pick slots your players do not use for their own items.
A player who carries at least one button cannot die: damage that would be lethal is cancelled. Plan your game design around this, or remove the buttons for situations where players must be able to die.
How it works
Keybinds. For each type, the first definition in keybinds is the one used, so you cannot have two definitions for the same input. This includes HOTBAR_SLOT: it reacts to a single slot, chosen by hotbarSlot.
What each input means exactly:
| Type | Fires when |
|---|---|
SWAP_HAND | The player presses F. |
DROP | The player presses Q to drop an item (not while holding an item on the cursor). |
SNEAK | The player starts sneaking. |
SPRINT | The player starts sprinting. |
CHAT | The player sends a chat message. Pressing T alone does nothing. |
COMMAND | The player runs a command. |
HOTBAR_SLOT | The player selects the hotbar slot hotbarSlot (0 to 8). |
With cancelAction, the original event is cancelled: the hands are not swapped, the message or command is not sent. For DROP, dropCount (-1 for the whole stack, a number above 1 for a custom count) is only used when cancelAction is on.
Buttons. Buttons are tagged items. They are placed in the player's inventory when the player joins, respawns, or opens the crafting inventory. They cannot be moved, dragged, dropped, swapped to the off-hand, placed or eaten.
When a button is clicked, the extension picks the first clickActions binding whose clickType matches the click and whose criteria pass. If none does, it uses the first ALL binding whose criteria pass. A middle click or a number key counts as a left click. In the world, left and right clicks with a button in hand count as LEFT and RIGHT.
Configuration
All settings are fields of the Input Trigger Config entry.
keybinds fields
| Field | Description |
|---|---|
type | The input to listen to. |
enabled | Must be on for the definition to work. Off by default. |
cancelAction | Cancel the vanilla behaviour. |
actions | Action entries to run. |
delay | Ticks to wait before running the actions (0 runs them at once). |
cooldown | Ticks between two triggers for the same player and input (0 for none). |
dropCount | For DROP. 1 is a single item, -1 the whole stack. |
hotbarSlot | For HOTBAR_SLOT: the slot, 0 to 8. |
criteria | Conditions for the trigger to run. |
inventoryButtons fields
| Field | Description |
|---|---|
slot | Inventory slot, 0 to 40 (0 to 8 hotbar, 36 to 39 armor, 40 off-hand). In the crafting grid, 0 to 4. |
item | The item shown as the button. |
clickActions | List of bindings with a clickType, actions and criteria. |
delay | Ticks before the actions run. |
isCraftingGrid | Place the button in the 2x2 crafting grid instead of the inventory. |
criteria | Conditions for a click on the button to do anything. |
In the crafting grid, slot 0 is the result slot, which works as a "submit" button, and slots 1 to 4 are the four grid slots. A crafting result is blocked while a button sits in one of the grid slots, so nobody can duplicate items.
Entries
1 entries, generated from the extension source.
Manifests1
- Input Trigger ConfigPlayer Input Triggers Configuration
Troubleshooting
A keybind does nothing. enabled is off by default. Also check that the definition has actions, that the criteria match, and that you have only one definition for that type: only the first is read. The entry must be published, and there must be only one Input Trigger Config.
The action runs only now and then. The cooldown is shared for the same player and the same input, in ticks (20 ticks is one second). cancelAction still applies while the cooldown blocks the actions. DROP does not use the cooldown.
The F or Q key still does its normal action. Tick cancelAction. For the chat and command inputs, cancelAction stops the message or the command from being sent.
A button is not clickable, or does nothing. A click does nothing when the button's criteria fail, or when no clickActions binding matches the click type and there is no ALL binding. The actions must be action entries.
An item disappeared from the inventory. A button replaces the item in its slot each time buttons are placed. Choose a free slot.
A removed button stays in the inventory. Buttons are items tagged by the extension. When you delete or move a button in the configuration, the old items are cleared and the current buttons placed again the next time the player closes their inventory, joins or respawns.
The player does not die. This is intended: a player carrying a button cannot take lethal damage.