From 60a1fe8170c49abfc7d416d0f9f0e0a1f1c5e8f2 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 24 Sep 2023 09:46:48 +0200 Subject: Fixed item lore flickering when debug feature internal name is enabled. --- .../java/at/hannibal2/skyhanni/config/features/DevConfig.java | 6 ++++++ .../java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java index 2c5189bbc..5c0a2e286 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java @@ -52,6 +52,12 @@ public class DevConfig { @ConfigAccordionId(id = 0) public boolean showEmptyNames = false; + @Expose + @ConfigOption(name = "Show Item Rarity", desc = "Show item rarities in item lore.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean showItemRarity = false; + @Expose @ConfigOption(name = "Copy Internal Name", desc = "Copies the internal name of an item on key press in the clipboard.") @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 077945455..8870e2d79 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -274,8 +274,15 @@ class SkyHanniDebugsAndTests { if ((internalName == NEUInternalName.NONE) && !config.showEmptyNames) return event.toolTip.add("Internal Name: '${internalName.asString()}'") - val rarity = itemStack.getItemRarityOrNull(logError = false) ?: return - event.toolTip.add("rarity: $rarity") + } + + @SubscribeEvent + fun showItemRarity(event: ItemTooltipEvent) { + if (!config.showItemRarity) return + val itemStack = event.itemStack ?: return + + val rarity = itemStack.getItemRarityOrNull(logError = false) + event.toolTip.add("Item rarity: $rarity") } @SubscribeEvent -- cgit