Improve error message when commands fail to be added and make commands using the new system check for masking (#1404)

* Improve error message when command already exists

* Add app's name to the message

* Add app name to any command load failure and fix commands from new system masking existing ones

* Fix duplicated app name in an error

* Update to recent snapshot changes
This commit is contained in:
altrisi authored and GitHub committed 2022-06-27 14:09:03 +02:00
1 parent 286dbead14
commit 41991b0346
2 files changed
+9 -4

No files matched your search

@@ -389,6 +389,11 @@ public class CarpetScriptHost extends ScriptHost
}
if (appConfig.get(StringValue.of("commands")) != null)
{
if (scriptServer().isInvalidCommandRoot(getName()))
{
notifier.accept(Messenger.c("g A command with the app's name already exists in vanilla or an installed mod."));
return null;
}
try
{
LiteralArgumentBuilder<CommandSourceStack> command = readCommands(commandValidator);
@@ -404,7 +409,7 @@ public class CarpetScriptHost extends ScriptHost
catch (CommandSyntaxException cse)
{
// failed
notifier.accept(Messenger.c("r Failed to build command system for "+getName()+" thus failed to load the app: ", cse.getRawMessage()));
notifier.accept(Messenger.c("r Failed to build command system: ", cse.getRawMessage()));
return null;
}
@@ -451,7 +456,7 @@ public class CarpetScriptHost extends ScriptHost
if (scriptServer().isInvalidCommandRoot(getName()))
{
notifier.accept(Messenger.c("gi Tried to mask vanilla command."));
notifier.accept(Messenger.c("g A command with the app's name already exists in vanilla or an installed mod."));
return null;
}