mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 14:38:48 +00:00
improve ping regex
This commit is contained in:
1 file changed
+7
-1
@@ -82,7 +82,13 @@ public class PingHandler implements Listener {
|
||||
|
||||
return message.replaceText(TextReplacementConfig.builder()
|
||||
// \B(@Username|@Displayname)\b
|
||||
.match(Pattern.compile(String.format("\\B%1$s(%2$s|%3$s)\\b", prefix, recipient.username(), displayName), Pattern.CASE_INSENSITIVE))
|
||||
.match(Pattern.compile(
|
||||
String.format(
|
||||
"\\B%1$s(%2$s|%3$s)\\b",
|
||||
Pattern.quote(prefix),
|
||||
Pattern.quote(recipient.username()),
|
||||
Pattern.quote(displayName)),
|
||||
Pattern.CASE_INSENSITIVE))
|
||||
.replacement(matchedText -> {
|
||||
if (this.configFactory.primaryConfig().pings().playSound()) {
|
||||
recipient.playSound(this.configFactory.primaryConfig().pings().sound());
|
||||
|
||||
Reference in new issue
Block a user