BatchCommands
A simple scripting plugin that does what it is supposed to do.
BatchCommands
Batch commands: A scripting engine that does what it intends to do
Skript is a little too complex for most usage cases, so I made this plugin to be able to execute a series of commands from a file quickly.
For instance, you are setting up chunky. Normally you'd do: `/chunky world world` `/chunky radius 1500` `/chunky shape circle` and `/chunky start` But what if you are doing this across multiple servers and are lazy enough to not want to do so? Here's what I aim to solve: repetative mannual labor. We can now create a file within the `/plugins/BatchCommands/batches` folder named `chunky.batch` Inside, it would look like this: ``` chunky world world chunky radius 1500 chunky shape circle chunky start ``` Now all you have to do is type `/filebatch chunky.batch` (Live tab completion fully supported).
Now, this is almost all the features anyone would possibly need in their lifetime. But what if we want more? What if I want to wait one second (twenty ticks) before starting the chunky worldgen? The script will use our decorator `!sleep ticks` ``` chunky world world chunky radius 1500 chunky shape circle !sleep 1 chunky start ``` Now this plugin will execute the first three commands and then wait 20 ticks (one second) to perform the subsequent command.
Need help with the syntax? Don't worry, we have an extensive linting system that is highly configurable.
Configuration options will be provided below
config.yml
```yaml
-------------------------------------------------- #
BatchCommands Configuration #
-------------------------------------------------- #
Enable this to see more detailed logs in the console.
This is useful for server administrators for debugging purposes.
debug-mode: false
-------------------------------------------------- #
Execution Settings #
-------------------------------------------------- #
WARNING: Modifying these settings can create #
potential security risks. Understand the #
implications before changing them. #
-------------------------------------------------- #
execution:
Default Executor: CONSOLE or SENDER
Determines who runs the commands inside the batch file by default.
- CONSOLE: (Default, Safest) All commands are run by the server console.
- SENDER: (RISKY) Commands are run by the player who initiated the /filebatch command.
This is dangerous if non-admins have the permission to run this command,
as they could execute commands with their own (potentially limited) permissions.
default-executor: CONSOLE
Stop on Error: true or false
If true, the batch execution will halt immediately if any command fails.
If false (RISKY), the batch will continue even if a command fails, which can lead to
unexpected behavior or incomplete actions.
stop-on-error: true
Allow OP Commands: true or false
If false (Default, Safest), commands like /op, /deop, etc., are blocked from running
through this plugin, regardless of the executor.
If true (EXTREMELY RISKY), these commands are allowed. If 'default-executor' is SENDER,
a player could write a batch file with "op <their_name>" and try to gain operator status.
allow-op-commands: false
Command Blacklist: A list of commands that can NEVER be run.
This is a final safeguard against catastrophic commands.
Commands should be listed without the slash. e.g., "stop" not "/stop".
command-blacklist: - "stop" - "reload" - "rl" - "restart" - "plugman"
lint-engine:
Lint engine mode
BEFORE - check before executing the script
AS_WE_GO - check as we go (less thorough, but faster startup)
engine-mode: BEFORE checking-order: - "EMPTY_FILE" # Checks if the file contains any executable lines. - "ILLEGAL_CMD" # Checks for blacklisted or disabled OP commands. - "UNKNOWN_DECORATOR" # Checks for decorators that don't exist (e.g., !fly). - "SYNTAX_ERRS" # Checks for malformed decorators (e.g., !sleep without a number). - "RECURSIVE_EXECUTION" # Checks if the file tries to call itself. max-checking-time: 1000 #Max checking time for lint engine, if it exceeds this we will respect the next setting
Possible options:
STOP - Stop the execution
TRY_AGAIN - Retry, max attempts can be changed
STOP_AND_WARN - Notify console of this error
FORCE_START - forcably start the script - THIS WILL LEAD TO EXPLOITS!!!
if-exceed-max-time: STOP_AND_WARN max-retry-attempts: 5
scripting:
This is the character that denotes a comment line in the batch file.
Any line starting with this character will be ignored during execution.
Default is "#".
comment-char: "#"
Decorator Character
This character is used to identify special decorators in the batch file.
For example, "!sleep 5" uses "!" as the decorator character.
Default is "!".
decorator-char: "!" timing:
Ticking modes:
WORLD - Uses the world's ticks (synchronous, affected by TPS)
INTERNAL - Uses an internal timer to schedule sleep tasks (Not yet implemented)
CLOCK - Uses the server's clock to schedule sleep tasks (Not yet implemented)
ticking-mode: WORLD
```