Skip to content

Commit

Permalink
Fix feather crashing by catching error
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Jan 22, 2024
1 parent be1203f commit d51b23b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.awt.*;
import java.lang.annotation.ElementType;
Expand All @@ -50,6 +52,7 @@
* @author leijurv
*/
public final class Settings {
private static final Logger LOGGER = LoggerFactory.getLogger("Baritone");

/**
* Allow Baritone to break blocks
Expand Down Expand Up @@ -1209,8 +1212,12 @@ public final class Settings {
*/
@JavaOnly
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);
try {
final GuiMessageTag tag = useMessageTag.value ? Helper.MESSAGE_TAG : null;
Minecraft.getInstance().gui.getChat().addMessage(msg, null, tag);
} catch (Throwable t) {
LOGGER.warn("Failed to log message to chat: " + msg.getString(), t);
}
});

/**
Expand Down

0 comments on commit d51b23b

Please sign in to comment.