From 93576728a754b36b7f139d6c45bcbf2ec203d441 Mon Sep 17 00:00:00 2001 From: Cow Date: Mon, 2 Aug 2021 17:56:51 +0200 Subject: Disabled dungeon tooltip cleaner inside dungeons - Also fixed a rare crash caused by missing reforges in item names --- CHANGELOG.md | 1 + .../cowlection/listener/skyblock/DungeonsListener.java | 2 +- src/main/java/de/cowtipper/cowlection/util/Utils.java | 12 +++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eba8214..bbffd42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - `/moo config` sub-category explanations now default to "tooltip *without* darkened background", as the darkened background was more irritating than helpful - MC Log file search now skips large files to prevent huge log files from blocking the search - Dungeon Party Finder: Each dungeon class can now also be blocked or blocked if duplicated (= red party background) +- Disabled dungeon tooltip cleaner inside dungeons (+ fixed a rare crash) ### Fixed - 'Show Dungeon item base stats' feature now works with HPB'd items and master stars diff --git a/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java b/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java index 57afdb1..b70dc25 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java @@ -123,7 +123,7 @@ public class DungeonsListener { if (e.itemStack == null || e.toolTip == null) { return; } - boolean toggleKeyBindingPressed = MooConfig.isDungeonItemTooltipToggleKeyBindingPressed(); + boolean toggleKeyBindingPressed = MooConfig.isDungeonItemTooltipToggleKeyBindingPressed() && !main.getDungeonCache().isInDungeon(); MooConfig.Setting showItemQualityAndFloorDisplay = MooConfig.getShowItemQualityAndFloorDisplay(); boolean showItemQualityAndFloor = showItemQualityAndFloorDisplay == MooConfig.Setting.ALWAYS || (showItemQualityAndFloorDisplay == MooConfig.Setting.SPECIAL && toggleKeyBindingPressed); diff --git a/src/main/java/de/cowtipper/cowlection/util/Utils.java b/src/main/java/de/cowtipper/cowlection/util/Utils.java index 9a07ab8..0d2290d 100644 --- a/src/main/java/de/cowtipper/cowlection/util/Utils.java +++ b/src/main/java/de/cowtipper/cowlection/util/Utils.java @@ -376,11 +376,13 @@ public final class Utils { reforgeLength = reforgePrefix.length() - 1; } - if (strikethrough) { - modifiedItemName.insert(reforgeInItemName, grayedOutFormatting) - .insert(reforgeInItemName + reforgeLength + grayedOutFormatting.length(), originalItemName.substring(0, reforgeInItemName)); - } else { - modifiedItemName.delete(reforgeInItemName, reforgeInItemName + reforgeLength); + if(reforgeInItemName >= 0) { + if (strikethrough) { + modifiedItemName.insert(reforgeInItemName, grayedOutFormatting) + .insert(reforgeInItemName + reforgeLength + grayedOutFormatting.length(), originalItemName.substring(0, reforgeInItemName)); + } else { + modifiedItemName.delete(reforgeInItemName, reforgeInItemName + reforgeLength); + } } } } -- cgit