Merge pull request #772 from PlaceholderAPI/fix/771-identifier-replacement

Fix #771
This commit is contained in:
PiggyPiglet 2021-12-27 15:21:30 +08:00 committed by GitHub
commit ca088227c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,14 +126,15 @@ public final class CharsReplacer implements Replacer {
}
}
final String identifierString = identifier.toString().toLowerCase();
final String identifierString = identifier.toString();
final String lowercaseIdentifierString = identifierString.toLowerCase();
final String parametersString = parameters.toString();
identifier.setLength(0);
parameters.setLength(0);
if (oopsitsbad) {
builder.append(closure.head).append(identifier);
builder.append(closure.head).append(identifierString);
if (identified) {
builder.append('_').append(parametersString);
@ -145,9 +146,9 @@ public final class CharsReplacer implements Replacer {
continue;
}
final PlaceholderExpansion placeholder = lookup.apply(identifierString);
final PlaceholderExpansion placeholder = lookup.apply(lowercaseIdentifierString);
if (placeholder == null) {
builder.append(closure.head).append(identifierString);
builder.append(closure.head).append(lowercaseIdentifierString);
if (identified) {
builder.append('_');
@ -159,7 +160,7 @@ public final class CharsReplacer implements Replacer {
final String replacement = placeholder.onRequest(player, parametersString);
if (replacement == null) {
builder.append(closure.head).append(identifierString);
builder.append(closure.head).append(lowercaseIdentifierString);
if (identified) {
builder.append('_');