diff --git a/src/main/java/tech/showierdata/pickaxe/config/ModMenuIntergrationImpl.java b/src/main/java/tech/showierdata/pickaxe/config/ModMenuIntergrationImpl.java index 7b8183b..61cb3af 100644 --- a/src/main/java/tech/showierdata/pickaxe/config/ModMenuIntergrationImpl.java +++ b/src/main/java/tech/showierdata/pickaxe/config/ModMenuIntergrationImpl.java @@ -39,7 +39,7 @@ public ModMenuIntergrationImpl() { public void saveConfig() { Pickaxe.LOGGER.info("Saving config"); - ((Function)Options.getInstance().chatClear).apply(false); // Result is ignored + Options.getInstance().chatClear.apply(false); // Result is ignored try { File file = new File(configPath); @@ -190,7 +190,7 @@ public void createTimerConfig(YetAnotherConfigLib.@NotNull Builder builder) { ) .build() ) - + .group(OptionGroup.createBuilder() .name(Text.literal("Moon Door Timer")) .option(Option.createBuilder() diff --git a/src/main/java/tech/showierdata/pickaxe/config/Options.java b/src/main/java/tech/showierdata/pickaxe/config/Options.java index f18b585..ac22488 100644 --- a/src/main/java/tech/showierdata/pickaxe/config/Options.java +++ b/src/main/java/tech/showierdata/pickaxe/config/Options.java @@ -9,6 +9,7 @@ import java.awt.*; import java.io.File; import java.io.IOException; +import java.util.function.Function; public class Options { public boolean enabled = true; @@ -28,7 +29,7 @@ public class Options { public final MsgStackConfig msgStackConfig; public final MDTConfig mdtConfig; - public Object chatClear; + public Function chatClear; static Options INSTANCE; diff --git a/src/main/java/tech/showierdata/pickaxe/mixin/ChatHudMixin.java b/src/main/java/tech/showierdata/pickaxe/mixin/ChatHudMixin.java index 480cb94..53fc71e 100644 --- a/src/main/java/tech/showierdata/pickaxe/mixin/ChatHudMixin.java +++ b/src/main/java/tech/showierdata/pickaxe/mixin/ChatHudMixin.java @@ -48,15 +48,10 @@ public void optionUpdateClear(MinecraftClient client, CallbackInfo info) { * Wanted to do void but can't return void for some reason * Instead I return a "success" boolean */ - Options.getInstance().chatClear = new Function() { - public Boolean apply(Boolean clearHistory) { - try { - clear(clearHistory); - return true; - } - catch (Error ignored) { - return false; - } + Options.getInstance().chatClear = new Function() { + public Void apply(Boolean clearHistory) { + clear(clearHistory); + return null; } }; }