-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Milestone
Description
The auto-command system is a feature of Essentials that should be implemented either as part of the core API or as a standalone plugin. Basically, it enables running commands automatically based on various triggers like time or game events. In any case, it should be implemented as a standalone ICommandTriggerService
that depends on ICommandService
to execute the commands.
Requirements
- Enable automatically executing commands based on time:
- Once at specific time
- Repeated on an interval based on real-world time
- Repeated on an interval based on time since service initialization
- Enable automatically executing commands based on core state:
- Core has finished loading (CoreState.AfterStart)
- Core has begun stopping (CoreState.BeforeStop)
- Allow plugins to define their own trigger types and options and include contextual information that can be substituted into commands a-la string interpolation, for example:
- Player joined trigger ->
tell {playerName} Welcome to the server! There are {playerCount} players online.
- Player count goes over 3 ->
say {playerCount} on the sidewalk is never allowed!
- Player joined trigger ->
Example configuration with various trigger types would look something like:
triggers:
restart: # Restarts the server every day at midnight
type: cron # https://en.wikipedia.org/wiki/Cron
time: 0 0 * * *
command: restart
plugDiscord: # Sends a message to chat every 5 minutes, simpler version of the cron trigger
type: timeInterval
interval: 5m # This is a custom option defined by the timeInterval trigger type.
command: say Join our discord at (link)!
welcomePlayer: # Triggers every time a player joins the server
type: playerJoin
command: tell {playerName} Welcome to the server! there are {playerCount} players online.
crowded: # Triggers when the player count changes from a value less than or equal to 3 to a value greater than 3
type: playerCount
expression: >3 # This is a custom option defined by the playerCount trigger type.
command: say {playerCount} on the sidewalk is never allowed!