Skip to main content

InputTracker

Run actions from F, Q, Shift, Ctrl, hotbar slots and clickable inventory buttons.

Freev0.5Utilities
RequiresTypeWriter0.9Paper1.21+

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​

  1. Use Paper 1.21 or later. No packet library is needed.
  2. 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:

  1. 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.
  2. In keybinds, add an item. Set type to SWAP_HAND, tick enabled (it is off by default), and tick cancelAction so the hands are not swapped.
  3. In its actions, select the action entry that opens your menu. Set cooldown to 10 ticks to avoid double triggers.
  4. In inventoryButtons, add an item. Set slot to 8 (the last hotbar slot) and choose the item to show, for example a clock named <gold>Menu.
  5. In its clickActions, add a binding with clickType LEFT and the same action in actions.
  6. Publish. Players receive the button when they join or respawn.
warning

A button replaces whatever item is in its slot. Pick slots your players do not use for their own items.

warning

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:

TypeFires when
SWAP_HANDThe player presses F.
DROPThe player presses Q to drop an item (not while holding an item on the cursor).
SNEAKThe player starts sneaking.
SPRINTThe player starts sprinting.
CHATThe player sends a chat message. Pressing T alone does nothing.
COMMANDThe player runs a command.
HOTBAR_SLOTThe 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

FieldDescription
typeThe input to listen to.
enabledMust be on for the definition to work. Off by default.
cancelActionCancel the vanilla behaviour.
actionsAction entries to run.
delayTicks to wait before running the actions (0 runs them at once).
cooldownTicks between two triggers for the same player and input (0 for none).
dropCountFor DROP. 1 is a single item, -1 the whole stack.
hotbarSlotFor HOTBAR_SLOT: the slot, 0 to 8.
criteriaConditions for the trigger to run.

inventoryButtons fields

FieldDescription
slotInventory slot, 0 to 40 (0 to 8 hotbar, 36 to 39 armor, 40 off-hand). In the crafting grid, 0 to 4.
itemThe item shown as the button.
clickActionsList of bindings with a clickType, actions and criteria.
delayTicks before the actions run.
isCraftingGridPlace the button in the 2x2 crafting grid instead of the inventory.
criteriaConditions 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

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.