Skip to content

Commit

Permalink
fix: Staff join messages not redirecting [skip ci] (#2369)
Browse files Browse the repository at this point in the history
fix: Staff join messages not redirecting
  • Loading branch information
DonkeyBlaster committed Mar 15, 2024
1 parent c5abcc5 commit ac9998e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright © Wynntils 2022-2023.
* Copyright © Wynntils 2022-2024.
* This file is released under LGPLv3. See LICENSE for full license details.
*/
package com.wynntils.features.redirects;
Expand Down Expand Up @@ -535,10 +535,11 @@ public class LoginRedirector extends SimpleRedirector {
private static final String RANK_STRING =
Arrays.stream(PlayerRank.values()).map(PlayerRank::getTag).collect(Collectors.joining());
// Test in ChatRedirectFeature_LoginRedirector_FOREGROUND_PATTERN
private static final Pattern FOREGROUND_PATTERN = Pattern.compile(
"^(?<rank>[" + RANK_STRING + "]) §#[0-9a-f]{6,8}(?:§o)?(?<name>[\\w ]{1,20})§. has just logged in!$");
private static final Pattern BACKGROUND_PATTERN = Pattern.compile("^(?:§8)?\\[(§.)+\\|?(§.)*(?<rank>["
+ RANK_STRING + "]) §#[0-9a-f]{6,8}(?:§o)?(?<name>[\\w ]{1,20})§. has just logged in!$");
private static final Pattern FOREGROUND_PATTERN = Pattern.compile("^(?<rank>[" + RANK_STRING
+ "]) §(?:#[0-9a-f]{6,8}|.)(?:§o)?(?:§<\\d>)?(?<name>[\\w ]{1,20})§. has just logged in!$");
private static final Pattern BACKGROUND_PATTERN =
Pattern.compile("^(?:§8)?\\[(§.)+\\|?(§.)*(?<rank>[" + RANK_STRING
+ "]) §(?:#[0-9a-f]{6,8}|.)(?:§o)?(?:§<\\d>)?(?<name>[\\w ]{1,20})§. has just logged in!$");

@Override
protected Pattern getForegroundPattern() {
Expand Down
4 changes: 4 additions & 0 deletions fabric/src/test/java/TestRegex.java
Expand Up @@ -216,6 +216,10 @@ public void ChatRedirectFeature_LoginRedirector_FOREGROUND_PATTERN() {
p.shouldMatch("\uE023 §#44aa3300v8j§a has just logged in!");
// champion nickname
p.shouldMatch("\uE017 §#ffe60000§ocharlie268IsAWizard§6 has just logged in!");
// moderator nickname, new style
p.shouldMatch("\uE01F §6§o§<1>Navi§e has just logged in!");
// music, new style
p.shouldMatch("\uE020 §3Texilated§b has just logged in!");
}

@Test
Expand Down

0 comments on commit ac9998e

Please sign in to comment.