mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-02-05 03:45:28 +01:00
Add fast path check for closure.head and closure.tail
This commit is contained in:
parent
5c8086150a
commit
f31dd2bea9
@ -46,7 +46,8 @@ public final class CharsReplacer implements Replacer {
|
||||
@Override
|
||||
public String apply(@NotNull final String text, @Nullable final OfflinePlayer player,
|
||||
@NotNull final Function<String, @Nullable PlaceholderExpansion> lookup) {
|
||||
if (text.indexOf(closure.head) == -1) { // Fast path - return directly if no placeholders
|
||||
// Fast path: If there's no closure.head or closure.tail, return the text immediately
|
||||
if (text.indexOf(closure.head) == -1 || text.lastIndexOf(closure.tail) == -1 || text.lastIndexOf(closure.tail) < text.indexOf(closure.head)) {
|
||||
return text;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user