Replace unhandled exception with a helpful message
This commit is contained in:
parent
638fcd393a
commit
dbc43b445b
@ -23,6 +23,7 @@ import baritone.api.Settings;
|
||||
import baritone.api.command.Command;
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.command.exception.CommandInvalidStateException;
|
||||
import baritone.api.command.exception.CommandInvalidTypeException;
|
||||
import baritone.api.command.helpers.Paginator;
|
||||
import baritone.api.command.helpers.TabCompleteHelper;
|
||||
@ -128,6 +129,12 @@ public class SetCommand extends Command {
|
||||
if (setting == null) {
|
||||
throw new CommandInvalidTypeException(args.consumed(), "a valid setting");
|
||||
}
|
||||
if (javaOnlySetting(setting)) {
|
||||
// ideally it would act as if the setting didn't exist
|
||||
// but users will see it in Settings.java or its javadoc
|
||||
// so at some point we have to tell them or they will see it as a bug
|
||||
throw new CommandInvalidStateException(String.format("Setting %s can only be used via the api.", setting.getName()));
|
||||
}
|
||||
if (!doingSomething && !args.hasAny()) {
|
||||
logDirect(String.format("Value of setting %s:", setting.getName()));
|
||||
logDirect(settingValueToString(setting));
|
||||
|
Loading…
Reference in New Issue
Block a user