[enhancement] Add /modded command to check what is different from vanilla
aria1th opened this issue ยท 2 comments
You can check what setting is modified with /carpet list, but its op-required command. Many mods / plugins / even server launchers frequently make mechanism different from vanilla, which makes people ask about "why this does not work". But if those things explain what is different from vanilla, there would be a lot less people who asks about it.
Unfortunately spigot / paper / other mods does not explain about what is different / modified, but server side mods- modifications should expose itself to client side whenever possible, to notice player what can go different from their single player / other server experience.
I tried to make this with some scripts, but not able to obtain file access to config file.
example:
/modded
-> show modified values
/modded (autocomplete)
- detailed description
/modded shulkerSpawningInEndCities
- shulkers will be able to respawn in end city.
To access raw Carpet rules in Scarpet you can use system_info('world_carpet_rules')
, although that gives you the whole list of changed and default rules, and doesn't print the description.
But I think you can get the output of the carpet
command via run()
, can't you? (at least I just tested run('carpet')
and it seems to work).
run('carpet')
Then you could parse the output to get what's changed by removing the header, footer, options, etc, and even get the descriptions by later running carpet <feature>
.
The format is always the same (line is == entry in the list in Scarpet):
- First line is the header (if there are changed rules)
- Changed rules start at second line, one per line
'- <ruleName> <options>'
- Last two lines are the footer.
So for example, you could get the first changed rule line with run('carpet'):1:1
, and from there just strip the '- ' and everything after the second space. Then to get the short info of each one, it is the third line from running the command with the rule name. Note that there may be extra info in the fourth+ line, but that tends to be less important/info about how to reset it. To get the current value is the one before the last, which also needs filtering.
You could then put the list of the filtered names in a suggester to make the autocomplete.
__command() ->
(
out = run('carpet'):1;
if (length(out) > 3,
for(slice(out, 1, -2), print(_));
null
,
'vanilla'
)
)
can use that for real quick solution
(except it uses a negative indexing solution for slice, which I just added so its not released so just replace that with slice(out, 1, length(out)-2)
for now.