1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

API Decent Tab Completer 2.0

Finally a decent tab completer API that is working like it should.

  1. CharcoalToast
    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

    Code (Text):
    1. completions of [the] command %string%
    2. # You can get, set, add, remove and delete completions
    3. # You will probably only use this with the set method
    4. #
    5. # You have to define the command WITH its arguments (unlike before).
    6. # For example:
    7. set completions of command "/test hello" to ("general_kenobi" and "there")
    Code (Text):
    1. all [the] completions
    2. # You can get and delete all the completions
    3. # This had some use in the previous version, but I don't think it's useful now.
    4. # You can use it to delete completions at the load of your Skript,
    5. # to prevent completions that you don't use anymore from still loading (since they are stored in a variable)
    Code (Text):
    1. # ONLY USABLE IN TabCompleteEvent
    2. (buffer|tab[bed] command)
    3. # This returns the command
    4. # If you execute '/sk reload' it will return '/sk' (always with a '/')
    Code (Text):
    1. # ONLY USABLE IN TabCompleteEvent
    2. tab arg[ument]( |-)%integer%
    3. # Returns the text at an argument in your command.
    4. # 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 (Text):
    1. # Example 1: Skript command completer
    2. on load:
    3.     delete all the completions
    4.     set completions of "/sk" to ("reload", "help", "update", "enable" and "disable")
    5.     set completions of "/sk reload" to ("all", "config", "aliases" and "scripts")
    6.  
    7. # 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 (Text):
    1. # Example 2: Just a silly command
    2. command /example <text>:
    3.     trigger:
    4.         broadcast arg-1
    5.  
    6. on load:
    7.     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.

Recent Updates

  1. Update 2.0 - Total rework

Recent Reviews

  1. Silencer
    Silencer
    4/5,
    Version: 2.0
    Nice Idea and works fine so far!
    will give it 5-stars if it also can tab complete on player names on specified arguments :)
    Thanks!
    1. CharcoalToast
      Author's Response
      Sorry for the late reaction.

      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::*}
  2. gundam89412
    gundam89412
    4/5,
    Version: 1.0
    use this api will break other plugins tab Complete
    ---------
    1. CharcoalToast
      Author's Response
      I will try to look into this issue, but please do not use the review section as a bug report next time.