Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6944

Incorrect tab complete documentation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • None
    • None
    • Windows

    • This server is running CraftBukkit version 3360-Spigot-f65de01-c2e0bbd (MC: 1.18.1) (Implementing API version 1.18.1-R0.1-SNAPSHOT)
    • Yes

    Description

      In the method onTabComplete([CommandSender|https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/command/CommandSender.html] sender, Command command, String alias, String[] args) is a mistake.
      https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/command/TabCompleter.html
      As the documentation says the parameter args is an array that contains all passed arguments including final partial argument and command label.

      This means if we enter a command and press TAB we should recceive the same string as the one in the chat bar excluding the slash. Why? So the command syntax is as following:
      /<label> [args0] [arg1] [arg2] [and so on]

      If we now enter a command e.g. /tabtest foo and use TAB. We should receive an array which would look like this: ["tabtest", "foo"]. But that isn't our result. Our result is ["foo"]! So the label isn't there as it should. Where is it? It's a little bit hidden inside Command.
      Right here:
      https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/command/Command.html#getLabel()
      so we need to do command.getLabel() to get our label. Or if we're fine with the alias we're able to use the alias parameter.

       

      Parts copied from:
      https://www.spigotmc.org/threads/spigot-bug-or-documentation-mistake.547577/

      Attachments

        Activity

          People

            Unassigned Unassigned
            Player_Schark Simon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: