Replace $/{ in shop placeholders

This commit is contained in:
fullwall 2024-02-18 21:06:02 +08:00
parent 19f08c4607
commit f498391c1f

View File

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