From dbc43b445b80be448ffe1c75e15b3e262e7ee6aa Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Mon, 24 May 2021 03:38:14 +0200 Subject: [PATCH] Replace unhandled exception with a helpful message --- src/main/java/baritone/command/defaults/SetCommand.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/baritone/command/defaults/SetCommand.java b/src/main/java/baritone/command/defaults/SetCommand.java index 5ef0b28a1..e9e35d413 100644 --- a/src/main/java/baritone/command/defaults/SetCommand.java +++ b/src/main/java/baritone/command/defaults/SetCommand.java @@ -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));