Force Key Pressed (Entity Action Type)

Holds a key down on the target player's client as if they pressed it.

Holds a Key down on the target player’s client, as if they had pressed it themselves.

Type ID: apoli:force_key_pressed

Aliases: apoli:press_key, apoli:force_key

Fields

FieldTypeDefaultPurpose
keyKeykey.apoli.primary_activeThe key to press. Any vanilla or modded keybind translation key, or an Apoli active key.
durationInteger1How many ticks to hold it. Values below 1 are clamped to 1.
releaseBooleanfalseCancel a force that is still running on this key instead of starting one.

The forced key reads as both held and just clicked, so it drives movement, attacking, using items, opening menus, and any Apoli active power bound to that key. Because the press is genuine client-side input, apoli:key_pressed conditions and apoli:action_on_key_sequence see it too.

Pressing a key that is already forced extends the hold to whichever duration is longer and queues another click edge.

Examples

Make the target jump:

{
  "type": "apoli:force_key_pressed",
  "key": "key.jump",
  "duration": 4
}

Force a two-second forced march:

{
  "type": "apoli:force_key_pressed",
  "key": "key.forward",
  "duration": 40
}

Stop an ongoing force early:

{
  "type": "apoli:force_key_pressed",
  "key": "key.forward",
  "release": true
}

Notes

  • Only works on players. Non-player entities are ignored.
  • Requires Apoli on the client. A vanilla client silently ignores the packet.
  • Key names are keybind translation keys (key.jump, key.attack, key.use, key.sneak, key.forward…), the same strings the Key data type accepts everywhere else.