Skip to content

Commit

Permalink
Escape placeholder text. Update dependencies. Bump version.
Browse files Browse the repository at this point in the history
Fixes #31 and #32.
  • Loading branch information
RezzedUp committed Dec 13, 2021
1 parent 0378f99 commit d200e8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.rezzedup</groupId>
<artifactId>discordsrv-staff-chat</artifactId>
<version>1.4.1</version>
<version>1.4.2</version>

<name>DiscordSRV-Staff-Chat</name>
<inceptionYear>2017</inceptionYear>
Expand Down Expand Up @@ -43,7 +43,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- DiscordSRV (via scarsz-nexus) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ public String get(@NullOr String placeholder)
return (result == null) ? "" : String.valueOf(result);
}

private static String escape(String literal)
{
return literal.replace("\\", "\\\\").replace("$", "\\$");
}

public String update(String message)
{
return PATTERN.matcher(message).replaceAll(mr -> {
String value = get(mr.group(1));
return (value.isEmpty()) ? mr.group() : value;
return escape((value.isEmpty()) ? mr.group() : value);
});
}

Expand Down

0 comments on commit d200e8a

Please sign in to comment.