Fix regex problem (#146)

This commit is contained in:
AlexDev_ 2024-01-21 14:31:13 +01:00 committed by GitHub
parent 7bd0ac3e0c
commit c4a07e1997
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -103,11 +103,13 @@ public enum Placeholder {
if (placeholder.parameterised) {
// Replace the placeholder with the result of the replacer function with the parameter
format = matcher.replaceAll(matchResult ->
placeholder.replacer.apply(StringUtils.chop(matchResult.group().replace("%" + placeholder.name().toLowerCase(), ""))
, plugin, player));
Matcher.quoteReplacement(
placeholder.replacer.apply(StringUtils.chop(matchResult.group().replace("%" + placeholder.name().toLowerCase(), ""))
, plugin, player)
));
} else {
// Replace the placeholder with the result of the replacer function
format = matcher.replaceAll(matchResult -> placeholder.replacer.apply(null, plugin, player));
format = matcher.replaceAll(matchResult -> Matcher.quoteReplacement(placeholder.replacer.apply(null, plugin, player)));
}
}