FlashyReese / CommandAliases

Alternate short commands for complex commands
MIT License
26 stars 6 forks source link

Unable to create suggestion provider using JSON_LIST option / documentation does not exist #52

Open justinbchen opened 1 year ago

justinbchen commented 1 year ago

I am attempting to create a JSON list suggestion provider:

...
{
  "child": "stop",
  "type": "argument",
  "argumentType": "minecraft:word",
  "suggestionProvider": {
    "suggestionMode": "JSON_LIST",
    "suggestion": "['stop']"
  },
...
}
...

I have tried various potential string list formats (such as "[\"stop\"]") but none of them seem to be creating the desired autocomplete option. How is this supposed to be done? And can the wiki be updated to include this information?

FlashyReese commented 1 year ago

"[\"stop\"]" is the correct format. I will update the wiki as soon as I can, I've just been busy with other stuff.

Example:

{
  "schemaVersion": 1,
  "commandMode": "COMMAND_CUSTOM",
  "command": "example",
  "children": [
    {
      "child": "stop",
      "type": "argument",
      "argumentType": "minecraft:word",
      "suggestionProvider": {
        "suggestionMode": "JSON_LIST",
        "suggestion": "[\"stop\",\"test\",\"pr\"]"
      },
      "actions": [
        {
          "command": "say Testing suggesting of {{stop}}",
          "commandType": "SERVER"
        }
      ]
    }
  ]
}

Output: image

I will this issue open so I don't forget to update the wiki.

justinbchen commented 1 year ago

Was able to figure out the issue; there cannot be multiple JSON lists for the same level of child command. JSON list must only be in the first listed child command or else none of the suggestions show up.

That said, having done that, I'm running into various other issues with debugging my command alias (such as the first child command's action being run even when the second child command is being called). I've found that Scarpet is a cleaner solution to my needs anyway, and since this is probably an issue on my end with my formatting so I won't bother you with the details.

FlashyReese commented 1 year ago

I'm running into various other issues with debugging my command alias (such as the first child command's action being run even when the second child command is being called)

Yeah, there is nothing I can do about these since that's just how the brigadier library is made(Minecraft's command library). You can't have multiple children if they are all argument types because they will end up conflicting, it's only there for literal types.