FORCE_COMMAND_PREFIX should be exposed to the API
This commit is contained in:
@@ -23,7 +23,6 @@ import baritone.api.pathing.goals.GoalBlock;
|
||||
import baritone.api.pathing.goals.GoalTwoBlocks;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import baritone.api.utils.Helper;
|
||||
import baritone.utils.command.BaritoneChatControl;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -45,6 +44,7 @@ import java.nio.IntBuffer;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static baritone.api.utils.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
|
||||
public class GuiClick extends GuiScreen {
|
||||
|
||||
@@ -88,7 +88,7 @@ public class GuiClick extends GuiScreen {
|
||||
.setColor(TextFormatting.WHITE)
|
||||
.setClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
BaritoneChatControl.FORCE_COMMAND_PREFIX + "help sel"
|
||||
FORCE_COMMAND_PREFIX + "help sel"
|
||||
));
|
||||
Helper.HELPER.logDirect(component);
|
||||
clickStart = null;
|
||||
|
||||
@@ -44,27 +44,15 @@ import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static baritone.api.utils.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
|
||||
public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
||||
|
||||
private static final Settings settings = BaritoneAPI.getSettings();
|
||||
private final ICommandManager manager;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* <p>
|
||||
* 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.
|
||||
* <p>
|
||||
* 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) {
|
||||
this.manager = baritone.getCommandManager();
|
||||
baritone.getGameEventHandler().registerEventListener(this);
|
||||
|
||||
@@ -35,7 +35,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static baritone.utils.command.BaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
import static baritone.api.utils.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
|
||||
public class HelpCommand extends Command {
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import java.util.stream.Stream;
|
||||
|
||||
import static baritone.api.utils.SettingsUtil.settingTypeToString;
|
||||
import static baritone.api.utils.SettingsUtil.settingValueToString;
|
||||
import static baritone.utils.command.BaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
import static baritone.api.utils.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
|
||||
public class SetCommand extends Command {
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static baritone.utils.command.BaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
import static baritone.api.utils.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
|
||||
public class WaypointsCommand extends Command {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user