From 54935e6e6e17f9f7ca54b3bef53b24f65278e86d Mon Sep 17 00:00:00 2001 From: msg-programs Date: Sun, 23 Apr 2023 12:21:34 +0200 Subject: Dungeon puzzle widget now works as intended. --- .../java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/StrMan.java | 4 ++++ .../skyblocker/skyblock/tabhud/widget/DungeonPuzzleWidget.java | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/StrMan.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/StrMan.java index 8cd77ac2..4a30cf0f 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/StrMan.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/StrMan.java @@ -44,6 +44,10 @@ public class StrMan { return null; } String str = txt.getString(); + if (str.length() == 0) { + return null; + } + Matcher m = p.matcher(str); if (!m.matches()) { LOGGER.error("ERROR: Regex {} failed for input \"{}\"", p.pattern(), str); diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/DungeonPuzzleWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/DungeonPuzzleWidget.java index 906d449b..3aba547c 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/DungeonPuzzleWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/DungeonPuzzleWidget.java @@ -24,9 +24,9 @@ public class DungeonPuzzleWidget extends Widget { // match a puzzle entry // group 1: name // group 2: status - // yes, that " ?" is needed. + // " ?.*" to diescard the solver's name if present // the teleport maze has a trailing whitespace that messes with the regex - private static final Pattern PUZZLE_PATTERN = Pattern.compile(" (.*): \\[(.*)\\] ?"); + private static final Pattern PUZZLE_PATTERN = Pattern.compile(" (.*): \\[(.*)\\] ?.*"); public DungeonPuzzleWidget(List list) { super(TITLE, Formatting.DARK_PURPLE.getColorValue()); @@ -43,6 +43,9 @@ public class DungeonPuzzleWidget extends Widget { IcoTextComponent itc = new IcoTextComponent(Ico.SIGN, t); this.addComponent(itc); pos++; + // code points for puzzle status chars unsolved and solved: 10022, 10004 + // not sure which one is which + // still need to find out codepoint for the puzzle failed char } this.pack(); -- cgit