mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 06:28:54 +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()
|
return message.replaceText(TextReplacementConfig.builder()
|
||||||
// \B(@Username|@Displayname)\b
|
// \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 -> {
|
.replacement(matchedText -> {
|
||||||
if (this.configFactory.primaryConfig().pings().playSound()) {
|
if (this.configFactory.primaryConfig().pings().playSound()) {
|
||||||
recipient.playSound(this.configFactory.primaryConfig().pings().sound());
|
recipient.playSound(this.configFactory.primaryConfig().pings().sound());
|
||||||
|
|||||||
Reference in new issue
Block a user