fix %-n$s
This commit is contained in:
parent
e616214c72
commit
2e1de26f34
1 changed files with 5 additions and 5 deletions
|
@ -235,9 +235,9 @@ function parseMinecraftMessage(component) {
|
|||
return "%s";
|
||||
});
|
||||
|
||||
translateString = translateString.replace(/%(\d+)\$s/g, (match, index, stringindex, string) => {
|
||||
const argIndex = parseInt(index) - 1;
|
||||
|
||||
translateString = translateString.replace(/%(-?\d+)\$s/g, (match, index, stringindex, string) => {
|
||||
const argIndex = index - 1;
|
||||
|
||||
if (argIndex < 0 || argIndex >= withArgs.length) {
|
||||
DefaultMsg = true;
|
||||
return match;
|
||||
|
@ -320,13 +320,13 @@ function parseMinecraftMessageNoColor(component) {
|
|||
});
|
||||
|
||||
translateString = translateString.replace(/%(\d+)\$s/g, (match, index, stringindex, string) => {
|
||||
const argIndex = parseInt(index) - 1;
|
||||
const argIndex = index - 1;
|
||||
|
||||
if (argIndex < 0 || argIndex >= withArgs.length) {
|
||||
DefaultMsg = true;
|
||||
return match;
|
||||
}
|
||||
|
||||
|
||||
if (stringindex > 0 && string[stringindex - 1] === '%') {
|
||||
return match;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue