From f7665da4f2e1355d35fdad2a38cd0ebf9bfd74cd Mon Sep 17 00:00:00 2001 From: Detlev1 Date: Mon, 12 Feb 2024 23:58:07 +0100 Subject: [PATCH] Fix showInChat, showInGui and showInDebug --- src/main/java/dev/meyi/bn/modules/Module.java | 22 +++++++++---------- .../java/dev/meyi/bn/modules/ModuleList.java | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/main/java/dev/meyi/bn/modules/Module.java b/src/main/java/dev/meyi/bn/modules/Module.java index a57b553..f1efd08 100644 --- a/src/main/java/dev/meyi/bn/modules/Module.java +++ b/src/main/java/dev/meyi/bn/modules/Module.java @@ -3,6 +3,7 @@ import cc.polyfrost.oneconfig.config.annotations.Switch; import cc.polyfrost.oneconfig.gui.OneConfigGui; import cc.polyfrost.oneconfig.hud.Hud; +import cc.polyfrost.oneconfig.platform.GuiPlatform; import cc.polyfrost.oneconfig.platform.Platform; import dev.meyi.bn.BazaarNotifier; import net.minecraft.client.Minecraft; @@ -36,24 +37,21 @@ public Module() { @Override protected boolean shouldShow() { - if(BazaarNotifier.inBazaar || Platform.getGuiPlatform().getCurrentScreen() != null){ - //Drawing at this case is handled by the ChestTickHandler to keep it above the gray gui background; - return false; - } - if (showInGuis && Platform.getGuiPlatform().getCurrentScreen() != null && - (Platform.getGuiPlatform().getCurrentScreen() instanceof OneConfigGui)) return false; if(enabled) { - if (showInChat && Platform.getGuiPlatform().isInChat()) return true; - if (showInDebug && Platform.getGuiPlatform().isInDebug()) return true; + GuiPlatform guiPlatform = Platform.getGuiPlatform(); + if(BazaarNotifier.inBazaar){ + //Drawing at this case is handled by the ChestTickHandler to keep it above the gray gui background; + return false; + } + if (showInGuis && (guiPlatform.getCurrentScreen() instanceof OneConfigGui)) return false; + if (showInChat && guiPlatform.isInChat()) return true; + if (showInDebug && guiPlatform.isInDebug()) return true; + if (showInGuis && guiPlatform.getCurrentScreen() != null) return true; return showEverywhere; }else { return false; } } - - public boolean shouldShowGui(){ - return enabled && (BazaarNotifier.inBazaar || showInGuis || showInChat || showInDebug || showEverywhere); - } public abstract void draw(); protected abstract void reset(); diff --git a/src/main/java/dev/meyi/bn/modules/ModuleList.java b/src/main/java/dev/meyi/bn/modules/ModuleList.java index d9f18d9..8105def 100644 --- a/src/main/java/dev/meyi/bn/modules/ModuleList.java +++ b/src/main/java/dev/meyi/bn/modules/ModuleList.java @@ -87,7 +87,7 @@ public void pageFlipCheck() { public void drawAllGui(){ if (BazaarNotifier.config.enabled && BazaarNotifier.activeBazaar) { for (Module m : this) { - if (m.shouldShowGui()) { + if (m.isEnabled() && BazaarNotifier.inBazaar) { m.position.setSize(m.getModuleWidth(), m.getModuleHeight()); m.draw(); }