From 8b4ac3893ee20e047d63c86a6c734e32d717161b Mon Sep 17 00:00:00 2001 From: Logan Darklock Date: Thu, 19 Sep 2019 21:40:55 -0700 Subject: [PATCH] Tweaks and \n fix --- src/api/java/baritone/api/utils/Helper.java | 2 +- src/api/java/baritone/api/utils/ISchematic.java | 2 +- .../api/utils/command/BaritoneChatControl.java | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/api/java/baritone/api/utils/Helper.java b/src/api/java/baritone/api/utils/Helper.java index 87884cd2..5f77384b 100755 --- a/src/api/java/baritone/api/utils/Helper.java +++ b/src/api/java/baritone/api/utils/Helper.java @@ -87,7 +87,7 @@ public interface Helper { * @param color The color to print that message in */ default void logDirect(String message, TextFormatting color) { - Arrays.stream(message.split("\\n")).forEach(line -> { + Arrays.stream(message.split("\n")).forEach(line -> { ITextComponent component = new TextComponentString(line.replace("\t", " ")); component.getStyle().setColor(color); logDirect(component); diff --git a/src/api/java/baritone/api/utils/ISchematic.java b/src/api/java/baritone/api/utils/ISchematic.java index b2dfc308..d0b9ddbe 100644 --- a/src/api/java/baritone/api/utils/ISchematic.java +++ b/src/api/java/baritone/api/utils/ISchematic.java @@ -23,7 +23,7 @@ import net.minecraft.util.EnumFacing; import java.util.List; /** - * Basic representation of a schematic. Provides the dimensions and the desired statefor a given position relative to + * Basic representation of a schematic. Provides the dimensions and the desired state for a given position relative to * the origin. * * @author leijurv diff --git a/src/api/java/baritone/api/utils/command/BaritoneChatControl.java b/src/api/java/baritone/api/utils/command/BaritoneChatControl.java index 23bbd4a7..b5e64930 100644 --- a/src/api/java/baritone/api/utils/command/BaritoneChatControl.java +++ b/src/api/java/baritone/api/utils/command/BaritoneChatControl.java @@ -54,6 +54,18 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener { public final IBaritone baritone; public final IPlayerContext ctx; public final Settings settings = BaritoneAPI.getSettings(); + + /** + * In certain cases chat components need to execute commands for you. For example, the paginator automatically runs + * commands when you click the forward and back arrows to show you the previous/next page. + *

+ * If the prefix is changed in the meantime, then the command will go to chat. That's no good. So here's a permanent + * prefix that forces a command to run, regardless of the current prefix, chat/prefix control being enabled, etc. + *

+ * If used right (by both developers and users), it should be impossible to expose a command accidentally to the + * server. As a rule of thumb, if you have a clickable chat component, always use this prefix. If you're suggesting + * a command (a component that puts text into your text box, or something else), use {@link Settings#prefix}. + */ public static String FORCE_COMMAND_PREFIX = String.format("<<%s>>", UUID.randomUUID().toString()); public BaritoneChatControl(IBaritone baritone) {