Skip to content

Tab Completion of Custom Commands

Matej edited this page Dec 21, 2024 · 8 revisions

Making your custom commands you created in rules/commands.rs show via tab completion is easy in ChatControl 11.

Thanks to @TheIntolerant for contributing!

Solution 1: Use /dummy in the commands.yml

Open the commands.yml file in the root/server directory and use the "/dummy" command to route your custom command.

command-block-overrides: []
ignore-vanilla-permissions: false
aliases:
  # First example
  my-custom-command-i-made-in-rules:
  - dummy $1-
  # Second example
  adminchat:
  - channel send admin $1-

In the first "my-custom-command-i-made-in-rules" command, this command has no real command anywhere so we route to it using our /dummy command that does nothing.

In the second, we simply redirect typing /adminchat to /channel send admin <message>

Here is the rule for the /adminchat command for your reference:

# This rule only executes when the player 
# is not in the admin channel for reading.
match ^[/]adminchat\b
dont verbose
then warn {prefix_success} You are now writing to the admin channel.
ignore channel admin write
then command channel join admin write
then deny

# This rule only executes when the player
# is in the admin channel for writing.
match ^[/]adminchat\b
dont verbose
then warn {prefix_success} You are no longer writing to the admin channel.
require channel admin write
then command channel join standard write
then deny

Note: Due to the then deny operator, the alias in commands.yml won't ever execute the command you put in commands.yml.
Failure to add then deny will result in the command from commands.yml also being executed.


Solution 2 (Simple to Complex)

Use a third-party plugin, which can "register commands" or create "custom commands". The level of complexity will depend on the plugin you choose to use. Usually, these plugins should register the commands making them work with tab completion! However, it will be up to you to work out if a plugin does this or not by testing it yourself.

For example, CustomCommands. Please note, this is developed by someone else! If you need help you will need to contact them!

Clone this wiki locally