Skip to content

Commit 6ab4f6c

Browse files
committed
Make sure to replace the correct thing
1 parent 890a9e9 commit 6ab4f6c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/net/earthcomputer/clientcommands/command/VarCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ private static void loadFile() throws IOException {
143143
}
144144

145145
public static String replaceVariables(String originalString) {
146-
Matcher matcher = VARIABLE_PATTERN.matcher(originalString.replace("\\", "\\\\").replace("$", "\\$"));
146+
Matcher matcher = VARIABLE_PATTERN.matcher(originalString);
147147
StringBuilder builder = new StringBuilder();
148148
while (matcher.find()) {
149149
String group = matcher.group();
150-
matcher.appendReplacement(builder, variables.getOrDefault(group.substring(1, group.length() - 1), group));
150+
matcher.appendReplacement(builder, variables.getOrDefault(group.substring(1, group.length() - 1), group).replace("\\", "\\\\").replace("$", "\\$"));
151151
}
152152
matcher.appendTail(builder);
153153
return builder.toString();

0 commit comments

Comments
 (0)