From b9c5f23a671c50422303bf50e315d364b1354acf Mon Sep 17 00:00:00 2001 From: Cow Date: Sun, 26 Jul 2020 15:25:03 +0200 Subject: Small fixes - Remove ": " when copying chat messages - Fix dungeon tooltip cleaner cleaning a little bit too much - Temporary work-around to fix crash with other mods not being able to handle offline messages --- src/main/java/eu/olli/cowlection/listener/ChatListener.java | 3 +++ .../eu/olli/cowlection/listener/skyblock/DungeonsListener.java | 6 +++++- src/main/java/eu/olli/cowlection/util/VersionChecker.java | 8 +++++++- 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/eu/olli/cowlection/listener/ChatListener.java b/src/main/java/eu/olli/cowlection/listener/ChatListener.java index 6fbc179..42c6f84 100644 --- a/src/main/java/eu/olli/cowlection/listener/ChatListener.java +++ b/src/main/java/eu/olli/cowlection/listener/ChatListener.java @@ -107,6 +107,9 @@ public class ChatListener { chatData = main.getChatHelper().cleanChatComponent(chatComponent); } else { chatData = StringUtils.stripControlCodes(chatComponent.getUnformattedText()); + if (chatData.startsWith(": ")) { + chatData = chatData.substring(2); + } } GuiControls.setClipboardString(chatData); main.getChatHelper().sendAboveChatMessage(EnumChatFormatting.YELLOW + "Copied chat component to clipboard:", "" + EnumChatFormatting.BOLD + EnumChatFormatting.GOLD + "\u276E" + EnumChatFormatting.RESET + (copyWithFormatting ? chatComponent.getUnformattedText() : chatData) + EnumChatFormatting.BOLD + EnumChatFormatting.GOLD + "\u276F"); diff --git a/src/main/java/eu/olli/cowlection/listener/skyblock/DungeonsListener.java b/src/main/java/eu/olli/cowlection/listener/skyblock/DungeonsListener.java index 0ea2a0c..c10360b 100644 --- a/src/main/java/eu/olli/cowlection/listener/skyblock/DungeonsListener.java +++ b/src/main/java/eu/olli/cowlection/listener/skyblock/DungeonsListener.java @@ -152,6 +152,7 @@ public class DungeonsListener { while (tooltipIterator.hasNext()) { String line = tooltipIterator.next(); Matcher lineMatcher = TOOLTIP_LINE_PATTERN.matcher(line); + String lineWithoutFormatting = EnumChatFormatting.getTextWithoutFormattingCodes(line); if (lineMatcher.matches()) { if (EnumChatFormatting.getTextWithoutFormattingCodes(lineMatcher.group("prefix")).equals("Gear Score: ")) { // replace meaningless gear score with item quality (gear score includes reforges etc) @@ -214,6 +215,9 @@ public class DungeonsListener { tooltipIterator.set(newToolTipLine); } catch (NumberFormatException ignored) { } + } else if (lineWithoutFormatting.startsWith("Item Ability: ") || lineWithoutFormatting.startsWith("Full Set Bonus: ")) { + // stop replacing tooltip entries once we reach item ability or full set bonus + break; } } if (itemQualityBottom != null) { @@ -274,7 +278,7 @@ public class DungeonsListener { if (inventorySlot.getHasStack()) { int slotRow = inventorySlot.slotNumber / 9; int slotColumn = inventorySlot.slotNumber % 9; - // check if slot is one of the middle slots with actual minions + // check if slot is one of the middle slots with parties int maxRow = inventoryRows - 2; if (slotRow > 0 && slotRow < maxRow && slotColumn > 0 && slotColumn < 8) { int slotX = (int) ((guiLeft + inventorySlot.xDisplayPosition) / scaleFactor); diff --git a/src/main/java/eu/olli/cowlection/util/VersionChecker.java b/src/main/java/eu/olli/cowlection/util/VersionChecker.java index 8f05beb..b1a9d48 100644 --- a/src/main/java/eu/olli/cowlection/util/VersionChecker.java +++ b/src/main/java/eu/olli/cowlection/util/VersionChecker.java @@ -120,7 +120,13 @@ public class VersionChecker { } if (statusMsg != null) { - main.getChatHelper().sendMessage(statusMsg); + if (isCommandTriggered) { + main.getChatHelper().sendMessage(statusMsg); + } else { + IChatComponent finalStatusMsg = statusMsg; + new TickDelay(() -> main.getChatHelper().sendMessage(finalStatusMsg) + , 6 * 20); + } } } -- cgit