mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 11:49:12 +00:00
Ensure MessageFormat's are clean before parsing
This commit is contained in:
parent
4ce38bde36
commit
11836e6662
1 changed files with 2 additions and 0 deletions
|
@ -275,10 +275,12 @@ public class DiscordSettings implements IConf {
|
||||||
private MessageFormat generateMessageFormat(String content, String defaultStr, boolean format, String... arguments) {
|
private MessageFormat generateMessageFormat(String content, String defaultStr, boolean format, String... arguments) {
|
||||||
content = content == null ? defaultStr : content;
|
content = content == null ? defaultStr : content;
|
||||||
content = format ? FormatUtil.replaceFormat(content) : FormatUtil.stripFormat(content);
|
content = format ? FormatUtil.replaceFormat(content) : FormatUtil.stripFormat(content);
|
||||||
|
content = content.replace("'", "''");
|
||||||
for (int i = 0; i < arguments.length; i++) {
|
for (int i = 0; i < arguments.length; i++) {
|
||||||
content = content.replace("{" + arguments[i] + "}", "{" + i + "}");
|
content = content.replace("{" + arguments[i] + "}", "{" + i + "}");
|
||||||
content = content.replace("{" + arguments[i].toUpperCase() + "}", "{" + i + "}");
|
content = content.replace("{" + arguments[i].toUpperCase() + "}", "{" + i + "}");
|
||||||
}
|
}
|
||||||
|
content = content.replaceAll("\\{([^0-9]+)}", "'{$1}'");
|
||||||
return new MessageFormat(content);
|
return new MessageFormat(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue