diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 016b44f5..a3301cd2 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -69,6 +69,59 @@ public class ExampleBaritoneControl extends Behavior implements Helper { } msg = msg.substring(1); } + + List> toggleable = Baritone.settings().getAllValuesByType(Boolean.class); + for (Settings.Setting setting : toggleable) { + if (msg.equalsIgnoreCase(setting.getName())) { + setting.value ^= true; + event.cancel(); + logDirect("Toggled " + setting.getName() + " to " + setting.value); + return; + } + } + if (msg.equals("baritone") || msg.equals("settings")) { + for (Settings.Setting setting : Baritone.settings().allSettings) { + logDirect(setting.toString()); + } + event.cancel(); + return; + } + if (msg.contains(" ")) { + String[] data = msg.split(" "); + if (data.length == 2) { + Settings.Setting setting = Baritone.settings().byLowerName.get(data[0]); + if (setting != null) { + try { + if (setting.value.getClass() == Long.class) { + setting.value = Long.parseLong(data[1]); + } + if (setting.value.getClass() == Integer.class) { + setting.value = Integer.parseInt(data[1]); + } + if (setting.value.getClass() == Double.class) { + setting.value = Double.parseDouble(data[1]); + } + if (setting.value.getClass() == Float.class) { + setting.value = Float.parseFloat(data[1]); + } + } catch (NumberFormatException e) { + logDirect("Unable to parse " + data[1]); + event.cancel(); + return; + } + logDirect(setting.toString()); + event.cancel(); + return; + } + } + } + if (Baritone.settings().byLowerName.containsKey(msg)) { + Settings.Setting setting = Baritone.settings().byLowerName.get(msg); + logDirect(setting.toString()); + event.cancel(); + return; + } + if (msg.startsWith("goal")) { event.cancel(); String[] params = msg.substring(4).trim().split(" "); @@ -369,56 +422,5 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - List> toggleable = Baritone.settings().getAllValuesByType(Boolean.class); - for (Settings.Setting setting : toggleable) { - if (msg.equalsIgnoreCase(setting.getName())) { - setting.value ^= true; - event.cancel(); - logDirect("Toggled " + setting.getName() + " to " + setting.value); - return; - } - } - if (msg.equals("baritone") || msg.equals("settings")) { - for (Settings.Setting setting : Baritone.settings().allSettings) { - logDirect(setting.toString()); - } - event.cancel(); - return; - } - if (msg.contains(" ")) { - String[] data = msg.split(" "); - if (data.length == 2) { - Settings.Setting setting = Baritone.settings().byLowerName.get(data[0]); - if (setting != null) { - try { - if (setting.value.getClass() == Long.class) { - setting.value = Long.parseLong(data[1]); - } - if (setting.value.getClass() == Integer.class) { - setting.value = Integer.parseInt(data[1]); - } - if (setting.value.getClass() == Double.class) { - setting.value = Double.parseDouble(data[1]); - } - if (setting.value.getClass() == Float.class) { - setting.value = Float.parseFloat(data[1]); - } - } catch (NumberFormatException e) { - logDirect("Unable to parse " + data[1]); - event.cancel(); - return; - } - logDirect(setting.toString()); - event.cancel(); - return; - } - } - } - if (Baritone.settings().byLowerName.containsKey(msg)) { - Settings.Setting setting = Baritone.settings().byLowerName.get(msg); - logDirect(setting.toString()); - event.cancel(); - return; - } } }