Illegal group reference & character to be escaped is missing
bobhenl opened this issue · 2 comments
Expected behavior
No errors:
First error: when you use the empty $ in your alias, or like 100$.
The second error:
character to be escaped is missing
Is related when player uses: bro
so the standalone \ char
Actual behavior
When users trigger the alias and there's included the $ standalone or with 100$ etc., it throws the error:
10:21:12] [Server thread/INFO]: [pm] XXXX -> YYYY: i got 310$ left
[10:21:12] [Craft Scheduler Thread - 1763 - DiscordSRV/WARN]: [DiscordSRV] Plugin DiscordSRV v1.28.0 generated an exception while executing task 37519606
java.lang.IllegalArgumentException: Illegal group reference
at java.base/java.util.regex.Matcher.appendExpandedReplacement(Matcher.java:1113) ~[?:?]
at java.base/java.util.regex.Matcher.appendReplacement(Matcher.java:951) ~[?:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.util.NamedValueFormatter.format(NamedValueFormatter.java:55) ~[DiscordSRV-Build-1.28.0.jar:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.util.NamedValueFormatter.formatExpressions(NamedValueFormatter.java:90) ~[DiscordSRV-Build-1.28.0.jar:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.modules.alerts.AlertListener.lambda$process$9(AlertListener.java:459) ~[DiscordSRV-Build-1.28.0.jar:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.DiscordSRV.lambda$translateMessage$69(DiscordSRV.java:2030) ~[DiscordSRV-Build-1.28.0.jar:?]
at java.base/java.util.Optional.map(Optional.java:260) ~[?:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.DiscordSRV.translateMessage(DiscordSRV.java:2030) ~[DiscordSRV-Build-1.28.0.jar:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.modules.alerts.AlertListener.process(AlertListener.java:494) ~[DiscordSRV-Build-1.28.0.jar:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.modules.alerts.AlertListener.lambda$runAlertsForEvent$2(AlertListener.java:260) ~[DiscordSRV-Build-1.28.0.jar:?]
at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:86) ~[purpur-1.21.jar:1.21-2284-4e55e26]
at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.21.jar:1.21-2284-4e55e26]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.21.jar:?]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Second error:
10:35:28] [Server thread/INFO]: [pm] XXXX -> YYYY: bro\
[10:35:28] [Craft Scheduler Thread - 1605 - DiscordSRV/WARN]: [DiscordSRV] Plugin DiscordSRV v1.28.0 generated an exception while executing task 38812786
java.lang.IllegalArgumentException: character to be escaped is missing
at java.base/java.util.regex.Matcher.appendExpandedReplacement(Matcher.java:1065) ~[?:?]
at java.base/java.util.regex.Matcher.appendReplacement(Matcher.java:951) ~[?:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.util.NamedValueFormatter.format(NamedValueFormatter.java:55) ~[DiscordSRV-Build-1.28.0.jar:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.util.NamedValueFormatter.formatExpressions(NamedValueFormatter.java:90) ~[DiscordSRV-Build-1.28.0.jar:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.modules.alerts.AlertListener.lambda$process$9(AlertListener.java:459) ~[DiscordSRV-Build-1.28.0.jar:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.DiscordSRV.lambda$translateMessage$69(DiscordSRV.java:2030) ~[DiscordSRV-Build-1.28.0.jar:?]
at java.base/java.util.Optional.map(Optional.java:260) ~[?:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.DiscordSRV.translateMessage(DiscordSRV.java:2030) ~[DiscordSRV-Build-1.28.0.jar:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.modules.alerts.AlertListener.process(AlertListener.java:494) ~[DiscordSRV-Build-1.28.0.jar:?]
at DiscordSRV-Build-1.28.0.jar/github.scarsz.discordsrv.modules.alerts.AlertListener.lambda$runAlertsForEvent$2(AlertListener.java:260) ~[DiscordSRV-Build-1.28.0.jar:?]
at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:86) ~[purpur-1.21.jar:1.21-2284-4e55e26]
at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.21.jar:1.21-2284-4e55e26]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.21.jar:?]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Steps to reproduce
I tried to make alert like this:
- Trigger: /msg
Channel: dms
Conditions:
- '#args.size() > 1'
Embed:
Color: "#839da8"
Author:
ImageUrl: "{embedavatarurl}"
Name: "Msg by {username} to ${#args.get(0)}"
Description: "${#allArgs}"
and now just use:
/msg $
Or /msg 100$
And to trigger the second one use:
/msg \ OR /msg something\
I guess there can be similar errors to these with some special characters. Maybe there can be solution to let this work?
Server software and version
[18:00:35 INFO]: Current Purpur Version: 1.21-2284-4e55e26 (MC: 1.21)* * You are running the latest version
Checks
- I am not using an outdated version of DiscordSRV.
- I asked in DiscordSRV's Discord server to see whether this issue is in fact a bug that needs to be fixed.
Ticket number or message link to where you asked in DiscordSRV's Discord server about this
19031 (https://discord.com/channels/135634590575493120/1272531794033643600/1272532432662429727)
Anything else
No response
[02:10:18 INFO]: Crates » Player Renzotom won in the Prime Crate: $500.
[02:10:18 WARN]: [DiscordSRV] Plugin DiscordSRV v1.29.0-SNAPSHOT generated an exception while executing task 7829172
java.lang.IllegalArgumentException: Illegal group reference
at java.base/java.util.regex.Matcher.appendExpandedReplacement(Matcher.java:1113) ~[?:?]
at java.base/java.util.regex.Matcher.appendReplacement(Matcher.java:951) ~[?:?]
at DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar/github.scarsz.discordsrv.util.NamedValueFormatter.format(NamedValueFormatter.java:55) ~[DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar:?]
at DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar/github.scarsz.discordsrv.util.NamedValueFormatter.formatExpressions(NamedValueFormatter.java:90) ~[DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar:?]
at DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar/github.scarsz.discordsrv.modules.alerts.AlertListener.lambda$process$10(AlertListener.java:460) ~[DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar:?]
at DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar/github.scarsz.discordsrv.DiscordSRV.lambda$translateMessage$69(DiscordSRV.java:2053) ~[DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar:?]
at java.base/java.util.Optional.map(Optional.java:260) ~[?:?]
at DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar/github.scarsz.discordsrv.DiscordSRV.translateMessage(DiscordSRV.java:2053) ~[DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar:?]
at DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar/github.scarsz.discordsrv.modules.alerts.AlertListener.process(AlertListener.java:495) ~[DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar:?]
at DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar/github.scarsz.discordsrv.modules.alerts.AlertListener.lambda$runAlertsForEvent$3(AlertListener.java:261) ~[DiscordSRV-1.29.0-SNAPSHOT-a5f854d.jar:?]
at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:86) ~[purpur-1.21.1.jar:1.21.1-2309-be61a07]
at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.21.1.jar:1.21.1-2309-be61a07]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.21.1.jar:?]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Sad is that it's happening even in the crates webhooks due to this issue