Clean up useMessageTag
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.api;
|
||||
|
||||
import baritone.api.utils.Helper;
|
||||
import baritone.api.utils.NotificationHelper;
|
||||
import baritone.api.utils.SettingsUtil;
|
||||
import baritone.api.utils.TypeUtils;
|
||||
@@ -1147,7 +1148,10 @@ public final class Settings {
|
||||
* via {@link Consumer#andThen(Consumer)} or it can completely be overriden via setting
|
||||
* {@link Setting#value};
|
||||
*/
|
||||
public final Setting<BiConsumer<Component, GuiMessageTag>> logger = new Setting<>((msg, tag) -> Minecraft.getInstance().gui.getChat().addMessage(msg, null, tag));
|
||||
public final Setting<Consumer<Component>> logger = new Setting<>((msg) -> {
|
||||
final GuiMessageTag tag = useMessageTag.value ? Helper.MESSAGE_TAG : null;
|
||||
Minecraft.getInstance().gui.getChat().addMessage(msg, null, tag);
|
||||
});
|
||||
|
||||
/**
|
||||
* The function that is called when Baritone will send a desktop notification. This function can be added to
|
||||
|
||||
@@ -163,12 +163,11 @@ public interface Helper {
|
||||
* Send components to chat with the [Baritone] prefix
|
||||
*
|
||||
* @param logAsToast Whether to log as a toast notification
|
||||
* @param useMessageTag Whether to use a message tag instead of a prefix
|
||||
* @param components The components to send
|
||||
*/
|
||||
default void logDirect(boolean logAsToast, boolean useMessageTag, Component... components) {
|
||||
default void logDirect(boolean logAsToast, Component... components) {
|
||||
MutableComponent component = Component.literal("");
|
||||
if (!logAsToast && !useMessageTag) {
|
||||
if (!logAsToast && !BaritoneAPI.getSettings().useMessageTag.value) {
|
||||
component.append(getPrefix());
|
||||
component.append(Component.literal(" "));
|
||||
}
|
||||
@@ -176,20 +175,10 @@ public interface Helper {
|
||||
if (logAsToast) {
|
||||
logToast(getPrefix(), component);
|
||||
} else {
|
||||
mc.execute(() -> BaritoneAPI.getSettings().logger.value.accept(component, useMessageTag ? MESSAGE_TAG : null));
|
||||
mc.execute(() -> BaritoneAPI.getSettings().logger.value.accept(component));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send components to chat with the [Baritone] prefix
|
||||
*
|
||||
* @param logAsToast Whether to log as a toast notification
|
||||
* @param components The components to send
|
||||
*/
|
||||
default void logDirect(boolean logAsToast, Component... components) {
|
||||
logDirect(logAsToast, BaritoneAPI.getSettings().useMessageTag.value, components);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send components to chat with the [Baritone] prefix
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user