CommandTree - SubCommand (Section) — SkBriggy
Addon: SkBriggy · Category: Section · Since: 1.4.0
Syntax
[optional] %*brigarg% arg[ument] [(named|with (name|id))] %*string%Description
Register a sub command in a command tree. A sub command is just an argument that can have its own sub commands and triggers. See [**SkBriggy Wiki**](https://github.com/ShaneBeee/SkBriggy/wiki/Command-Tree) for more detailed info. **Notes**: - A `greedy string` arg always has to be last, you cannot register another subcommand within it. - Optionals are a little funny, you cannot have a required subcommand within an optional subcommand. - Min/Max can only be used on number subcommands. - The name/id you choose for your subcommand will automatically be made into a local variable. - List arg types (ie: players/entities) will create list variables. DO NOT repeat names. See examples.
**Entries/Sections**: `permission` = Each subcommand can have its own permission. `suggestions` = You can apply suggestions (with tooltips) to a subcommand. See `apply suggestion` effect, and examples. `register arg` = Register another subcommand within this one. Supports multiple. `trigger` = Like any other command, this is what will execute when the command is run.
Examples
# Example with optional arg that can be bypassed
brig command tree /legamemode:
literal arg "gamemode" using "adventure", "creative", "spectator", "survival":
# When optional, the trigger will still run but the arg is ignored
optional players arg "players":
trigger:
# if the player arg is not used, we will default to the command sender
set {_players::*} to {_players::*} ? player
set {_gamemode} to {_gamemode} parsed as gamemode
set gamemode of {_players::*} to {_gamemode}
# Example similar to above but using 2 different triggers
brig command tree /spawn:
world arg "world":
trigger:
teleport player to spawn of {_world}
# if the argument isn't entered, this will execute
trigger:
teleport player to spawn of world of player
# Example showing off suggestions with tooltips
brig command tree /lewarp:
string arg "warp":
suggestions:
loop {warps::*}:
set {_s} to "&7x: &b%x coord of loop-value% &7y: &b%y coord of loop-value% &7z: &b%z coord of loop-value% &7world: &a%world of loop-value%"
apply suggestion loop-index with tooltip {_s}
trigger:
if {warps::%{_warp}%} is set:
teleport player to {warps::%{_warp}%}
else:
send "No warp available for %{_warp}%"
brig command tree /leban:
description: &bThis allows you to ban players
usages: /leban &7<&bplayers&7> &7<&btimespan&7>
players arg "players":
int arg "time":
string arg "span" using "minutes", "hours", "days":
# When optional, the trigger will still run but the arg is ignored
optional greedy string arg "reason":
trigger:
set {_timespan} to "%{_time}% %{_span}%" parsed as timespan
set {_reason} to {_reason} ? "Unknown Reason"
ban {_players::*} due to "&c" + {_reason} for {_timespan}
kick {_players::*} due to "&c" + {_reason}