🎯

CommandTriggers

Runs configured commands when players cross WorldEdit-defined region boundaries, a flexible building block for in-game cutscenes, gates, and event scripting.

Private Requires WorldEdit
About

CommandTriggers lets vanilla or other plugin commands execute automatically when certain events fire and conditions are met. The architecture is built around abstract triggers that listen for events and run an attached list of commands when activated.

Currently, only one trigger type is implemented: region, which fires when a player enters or exits a WorldEdit-selected region. The plugin's structure (an abstract Trigger class and a TriggerService) is set up so additional trigger types can be added later, block-break, item-pickup, login, scheduled, and so on.

Commands are executed as console, meaning they run with full server permissions regardless of who triggered them. The substring %EVENT_PLAYER% in any attached command is replaced with the username of the player who fired the trigger before execution, so a single trigger can target whoever crossed it (e.g. tp %EVENT_PLAYER% 0 80 0).

Regions and triggers, including their attached command lists, are persisted to the plugin's config.yml on every change and reloaded on startup.

How it works
1
Make a WorldEdit selection: use //wand and click two corners to define a 3D region.
2
Save it as a named region from inside that selection.
/ct regions create welcome_zone
3
Create a trigger bound to that region, firing on enter or exit.
/ct triggers create welcome region welcome_zone onEnter
4
Attach commands to run when the trigger fires. Quote multi-word commands.
/ct triggers trigger welcome commands add "say Welcome to the lobby!"
5
Players entering the region now run the attached command list, executed as console.
WorldEdit dependency: the plugin will not enable without WorldEdit installed on the server. This is hard-coded as a plugin dependency, region creation reads directly from WorldEdit's per-player selection state.
Commands

All commands are also available under the alias /ct. Permission required: commandtriggers.admin.

General
  • /commandtriggers help [<page>]
    Paginated list of all commands.
  • /commandtriggers version
    Displays the plugin version.
  • /commandtriggers saveCommand "<command>"
    Test utility, saves a single command for later execution. Used to verify console execution works.
  • /commandtriggers executeSavedCommand
    Test utility, runs the most recently saved command as console.
Regions
  • /commandtriggers regions list
    Lists all defined regions and their bounding boxes.
  • /commandtriggers regions create <regionId>
    Saves your current WorldEdit selection as a named region.
  • /commandtriggers regions remove <regionId>
    Removes a region and any triggers associated with it.
  • /commandtriggers regions toggleChecking
    Toggles a debug action-bar overlay showing which region you're currently inside.
Triggers
  • /commandtriggers triggers list
    Lists all command triggers and their types.
  • /commandtriggers triggers create <triggerId> region <regionId> <onEnter|onExit>
    Creates a region-based trigger that fires when players enter or exit the region.
  • /commandtriggers triggers remove <triggerId>
    Removes a command trigger.
Trigger, managing the attached command list
  • /commandtriggers triggers trigger <triggerId> commands list
    Lists commands in the order they will execute.
  • /commandtriggers triggers trigger <triggerId> commands add <command> [<atIndex>]
    Appends a command, or inserts it at the specified 1-based index (existing commands shift down).
  • /commandtriggers triggers trigger <triggerId> commands remove <index>
    Removes the command at the specified 1-based index.
  • /commandtriggers triggers trigger <triggerId> commands set <index> <command>
    Replaces the command at the specified 1-based index.
Trigger, modifying the trigger itself
  • /commandtriggers triggers trigger <triggerId> set region <regionId>
    For region triggers, rebinds the trigger to a different saved region.