-
-
Notifications
You must be signed in to change notification settings - Fork 35
Tab Completion of Custom Commands
Thanks to @TheIntolerant, for this tutorial!
Making your custom commands show via tab completion is complex and would require ChatControl to register the commands, which it does not do!
Here I will show three ways to make custom commands work in tab completion. Please note that for commands to start working via tab completion, a full server restart is required after making these changes.
In these examples we are going to make a short admin chat command "/ach" that can be tabbed, you can do this three ways.
In this example, we are making a command to chat in the admin channel.
The command is /ach <message>
For togglable commands, see Solution 2, as it is not possible to make these types of commands in commands.yml
alone.
Open the commands.yml
file in the root/server directory.
This is where you will make your custom command.
Once you have opened the file add the custom command under aliases
, then place the actual command below.
In this example our actual command is /channel send admin <message>
and the alias is /ach <message>
See here for an example!
command-block-overrides: []
ignore-vanilla-permissions: false
aliases:
ach:
- channel send admin $1-
Restart the server to make these changes go into full effect.
Use commands.yml
to create a custom command BUT ChatControl controls how the command functions.
In this example, we are making a togglable command for the admin channel, which will switch users between two channels.
The command is /ach
Open the commands.yml
file in the root/server directory.
This is where you will make your custom command.
Once you have opened the file add the custom command under aliases
, then add a random command under the custom command.
See here for an example!
command-block-overrides: []
ignore-vanilla-permissions: false
aliases:
ach:
- minecraft:say fake alias
Note: The command /minecraft:say fake alias
will get overwritten by ChatControl!
Ensure the "random command" is already registered (works with tab completion). We recommend using a vanilla command such as /minecraft:say
or /say
etc.
Open the /plugins/ChatControlRed/rules/command.rs
file and add the desired rules. See below for an example!
# This rule only executes when the player
# is not in the admin channel for reading.
match ^[/]ach\b
dont verbose
then warn 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 ^[/]ach\b
dont verbose
then warn You are no longer writing to the admin channel!
require channel admin write
then command channel join standard write
then deny
Due to the then deny
operator, the alias in commands.yml won't ever execute the "/say" command you put in there.
ChatControl will cancel the event if you add then deny
inside the ChatControl file.
Restart the server to make these changes go into full effect.
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!
© MineAcademy | Code Unique Minecraft Plugins & Servers In 20 Days
Installation
Troubleshooting
Basics
Learn
- Channels
- Formats
- Rules
- Rules Creator
- Messages
- Variables
- JavaScript Variables
- Running JavaScript Code
- Logs
- Spying
- Books
Tweaking
- Performance
- Chat Bots
- Groups
- Sound Notify
- Newcomer
- Super Cool Messages
- Custom Commands
- Listener Priorities
- JSON
- API
Tutorials
About