True-Name Nemesis crashes on "$" Player name (#7944)

This commit is contained in:
tool4ever
2025-07-05 08:54:14 +00:00
committed by GitHub
parent c66a72806d
commit 03ff2147db

View File

@@ -43,6 +43,7 @@ import forge.util.TextUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.*; import java.util.*;
import java.util.regex.Matcher;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -273,7 +274,7 @@ public final class StaticAbilityContinuous {
if (hostCard.hasChosenPlayer()) { if (hostCard.hasChosenPlayer()) {
Player cp = hostCard.getChosenPlayer(); Player cp = hostCard.getChosenPlayer();
input = input.replaceAll("ChosenPlayerUID", String.valueOf(cp.getId())); input = input.replaceAll("ChosenPlayerUID", String.valueOf(cp.getId()));
input = input.replaceAll("ChosenPlayerName", cp.getName()); input = input.replaceAll("ChosenPlayerName", Matcher.quoteReplacement(cp.getName()));
} }
if (hostCard.hasNamedCard()) { if (hostCard.hasNamedCard()) {
final String chosenName = hostCard.getNamedCard().replace(",", ";"); final String chosenName = hostCard.getNamedCard().replace(",", ";");