mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-11-18 00:46:55 +01:00
Only get expansions when checking for cleanable implementations
This commit is contained in:
parent
8a5d82d3a8
commit
11401f0bfd
@ -36,6 +36,7 @@ import org.bukkit.event.server.PluginEnableEvent;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class PlaceholderListener implements Listener {
|
||||
@ -126,7 +127,7 @@ public class PlaceholderListener implements Listener {
|
||||
}
|
||||
|
||||
if (ex.getPlugin().equalsIgnoreCase(n)) {
|
||||
if (PlaceholderAPI.unregisterPlaceholderHook(hook.getKey())) {
|
||||
if (PlaceholderAPI.unregisterExpansion(ex)) {
|
||||
plugin.getLogger().info("Unregistered placeholder expansion: " + ex.getIdentifier());
|
||||
}
|
||||
}
|
||||
@ -137,15 +138,15 @@ public class PlaceholderListener implements Listener {
|
||||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent e) {
|
||||
|
||||
Map<String, PlaceholderHook> placeholders = PlaceholderAPI.getPlaceholders();
|
||||
Set<PlaceholderExpansion> expansions = PlaceholderAPI.getExpansions();
|
||||
|
||||
if (placeholders.isEmpty()) {
|
||||
if (expansions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (PlaceholderHook hooks : placeholders.values()) {
|
||||
if (hooks instanceof Cleanable) {
|
||||
((Cleanable) hooks).cleanup(e.getPlayer());
|
||||
for (PlaceholderExpansion ex : expansions) {
|
||||
if (ex instanceof Cleanable) {
|
||||
((Cleanable) ex).cleanup(e.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user