Added unregisterExpansion method

This commit is contained in:
extendedclip 2018-03-24 12:58:15 -04:00
parent 11401f0bfd
commit 910c81bab8
1 changed files with 11 additions and 4 deletions

View File

@ -273,13 +273,20 @@ public class PlaceholderAPI {
getPlaceholders().forEach((key, value) -> {
if (value instanceof PlaceholderExpansion) {
PlaceholderExpansion ex = (PlaceholderExpansion) value;
if (!ex.persist()) {
Bukkit.getPluginManager().callEvent(new ExpansionUnregisterEvent(ex));
unregisterPlaceholderHook(key);
}
if (!ex.persist()) {
unregisterExpansion(ex);
}
}
});
}
public static boolean unregisterExpansion(PlaceholderExpansion ex) {
if (unregisterPlaceholderHook(ex.getIdentifier())) {
Bukkit.getPluginManager().callEvent(new ExpansionUnregisterEvent(ex));
return true;
}
return false;
}
public static Pattern getPlaceholderPattern() {
return PLACEHOLDER_PATTERN;