Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Figure Out How to Use COMMAND_LIST_LOOKUP Suggestions From Documentation #61

Open
jebug29 opened this issue Apr 5, 2024 · 1 comment

Comments

@jebug29
Copy link

jebug29 commented Apr 5, 2024

I'm trying to use this mod to fix some of the issues I have with Essential Command's (Fabric Mod) syntax and make it more like the syntax from EssentialsX (Paper Plugin). Essentially map /home tp home to just simply /home and then any other home to /home {home name}. So far I've figured out how to get everything working but the suggestions, and the documentation seems to cover nothing but CommandAliases' built-in database.

{
	"schemaVersion": 1,
	"commandMode": "COMMAND_CUSTOM",
	"command": "home",
	"message": "Teleporting to default home",
	"children": [
	{
		"child": "homename",
		"type": "argument",
		"argumentType": "minecraft:word",
		"suggestionProvider": {
			"suggestionMode": "COMMAND_LIST_LOOKUP",
			"suggestion": "essentialcommands:home tp"
		},
		"actions": [
		{
			"command": "essentialcommands:home tp {{homename}}",
			"commandType": "CLIENT"
		}
		]
	}
	],
	"actions": [
	{
		"command": "essentialcommands:home tp home",
		"commandType": "CLIENT"
	}
	]
}

(For clarity, I've remapped /home to essentialcommands:home, and the commands themselves do work).

When I try this I get the following message in my server console:

[Server thread/ERROR]: [SERVER] COMMAND_CUSTOM - Invalid suggestion "essentialcommands:home tp": <filepath>\homehome.json

I'm sure there's some other syntax I'm supposed to be using for this use case. Any help would be much appreciated!

Thanks!

@jebug29
Copy link
Author

jebug29 commented Apr 6, 2024

For now I've gotten around the problem by switching to the internal database and mimicking the behavior of the homes example file and writing a command to add and remove homes from a database.

Since I believe using command-literals as child commands is also undocumented in the Wiki, here's the JSON I wrote as an example:

{
	"schemaVersion": 1,
	"commandMode": "COMMAND_CUSTOM",
	"command": "dbhome",
	"message": "Give argument /dbhome <set|del> <home_name> to add home to tab-complete list",
	"children": [
	{
		"child": "set",
		"type": "literal",
		"message": "Add home to database",
		"children": [
		{
			"child": "home_name",
			"type": "argument",
			"argumentType": "minecraft:word",
			"message": "Added home {{home_name}} to database.",
			"actions": [
			{
				"command": "commandaliases database put $executor_name().homes.suggestions.{{home_name}} {{home_name}}",
				"commandType": "SERVER"
			}
			]
		}
		]
	},
	{
		"child": "del",
		"type": "literal",
		"message": "Remove home from database",
		"children": [
		{
			"child": "home_name",
			"type": "argument",
			"argumentType": "minecraft:word",
			"message": "Removed home {{home_name}} from database.",
			"actions": [
			{
				"command": "commandaliases database delete $executor_name().homes.suggestions.{{home_name}}",
				"commandType": "SERVER"
			}
			]
		}
		]
	}
	]
}

I hope this helps someone with a similar issue! I'll leave this open for now as documentation for COMMAND_LIST_LOOKUP would still be extremely helpful. This is a tremendously useful plugin, so thank you to the maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant