Replace $/{ in shop placeholders

This commit is contained in:
fullwall 2024-02-18 21:06:02 +08:00
parent 19f08c4607
commit f498391c1f
1 changed files with 5 additions and 2 deletions

View File

@ -446,8 +446,11 @@ public class ShopTrait extends Trait {
StringBuffer sb = new StringBuffer();
Matcher matcher = PLACEHOLDER_REGEX.matcher(string);
while (matcher.find()) {
matcher.appendReplacement(sb, Joiner.on(", ").join(
Iterables.transform(matcher.group(1).equals("cost") ? cost : result, NPCShopAction::describe)));
matcher.appendReplacement(sb,
Joiner.on(", ")
.join(Iterables.transform(matcher.group(1).equalsIgnoreCase("cost") ? cost : result,
NPCShopAction::describe))
.replace("$", "\\$").replace("{", "\\{"));
}
matcher.appendTail(sb);
return sb.toString();