- Contributors
- Mwexim (AKA CharcoalToast)
- Supported Minecraft Versions
- 1.9
- 1.10
- 1.11
- 1.12
- 1.13
- 1.14
- 1.15
Decent Tab Completer
A Tab Completer API that is actually useful and simple, with understandable syntax.
Syntax
Other features
Requirements
Examples
Disclaimer
I indeed based me on the idea someone created here. I actually made it better and easier to utilise with more functions. I advise you to use this one because I will update it sometimes to add some new features, but I just wanted to mention this, because I want to give him a sort of credits.
A Tab Completer API that is actually useful and simple, with understandable syntax.
Syntax
Code:
completions of [the] command %string%
# You can get, set, add, remove and delete completions
# You will probably only use this with the set method
#
# You have to define the command WITH its arguments (unlike before).
# For example:
set completions of command "/test hello" to ("general_kenobi" and "there")
Code:
all [the] completions
# You can get and delete all the completions
# This had some use in the previous version, but I don't think it's useful now.
# You can use it to delete completions at the load of your Skript,
# to prevent completions that you don't use anymore from still loading (since they are stored in a variable)
Code:
# ONLY USABLE IN TabCompleteEvent
(buffer|tab[bed] command)
# This returns the command
# If you execute '/sk reload' it will return '/sk' (always with a '/')
Code:
# ONLY USABLE IN TabCompleteEvent
tab arg[ument]( |-)%integer%
# Returns the text at an argument in your command.
# Works like normal command arguments ('arg-1', etc.)
Other features
- Easy to use: in most use cases, you only have to configure the completions at the load of your script. The plugin does the rest for you!
- User-friendly: when you type while tab-completing (this is going to feel nice for servers with 1.13+), it will only show completions that correspond to the command you typed. For example, if you typed "/test hel" and the completions were configured as "bye" and "hello", it will only show "hello" as a completion.
- The completions are stored in variables, so are never lost. There is a way to delete all completions, to prevent completions that aren't in use anymore from loading
- This should not interrupt with other plugins as long as you don't change completions from OTHER plugins that also use tab-completion. The message is to only use it for your plugins or for plugins that do not support it.
- Small resource: the code is actually only 70 lines long (when you remove all empty lines, probably 50 lines), so this doesn't make your resource incredibly large.
- Only one copy of this resource is needed per server
- You have the ability to edit completions at the event itself, allowing more custom completions (like players online, faction members online, bungeecord lobbies open, ...)
Requirements
- Skript: Every version should work (from Bensku of course)
- skript-mirror: Latest branch (2.0), this is used for the importation and the usage of the TabCompleteEvent
Examples
Code:
# Example 1: Skript command completer
on load:
delete all the completions
set completions of "/sk" to ("reload", "help", "update", "enable" and "disable")
set completions of "/sk reload" to ("all", "config", "aliases" and "scripts")
# You can also add support for this for every Skript file, by looping them and adding them when you call a tab-complete event.
Code:
# Example 2: Just a silly command
command /example <text>:
trigger:
broadcast arg-1
on load:
set completions of command "/example" to ("good morning gamers", "how are you" and "check our shop!")
Disclaimer
I indeed based me on the idea someone created here. I actually made it better and easier to utilise with more functions. I advise you to use this one because I will update it sometimes to add some new features, but I just wanted to mention this, because I want to give him a sort of credits.
This is actually possible. You just need to use TabCompleteEvent and add all the players manually to the completions at that event.
For example:
on TabCompleteEvent:
loop all players:
add name of loop-player to {_names::*}
set completions of "/yourcommand" to {_names::*}