Placeholders with identical patterns will now override previous registrations

This commit is contained in:
Auxilor
2023-06-03 14:23:15 +01:00
parent a6b7dda82d
commit 7c7052f5b9

View File

@@ -98,6 +98,7 @@ public final class PlaceholderManager {
// Storing as immutable set leads to slower times to register placeholders, but much
// faster times to access registrations.
Set<Placeholder> pluginPlaceholders = new HashSet<>(REGISTERED_PLACEHOLDERS.get(placeholder.getPlugin()));
pluginPlaceholders.removeIf(p -> p.getPattern().equals(placeholder.getPattern()));
pluginPlaceholders.add(placeholder);
REGISTERED_PLACEHOLDERS.put(placeholder.getPlugin(), ImmutableSet.copyOf(pluginPlaceholders));
}