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;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
public class PlaceholderListener implements Listener {
|
public class PlaceholderListener implements Listener {
|
||||||
@ -126,7 +127,7 @@ public class PlaceholderListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ex.getPlugin().equalsIgnoreCase(n)) {
|
if (ex.getPlugin().equalsIgnoreCase(n)) {
|
||||||
if (PlaceholderAPI.unregisterPlaceholderHook(hook.getKey())) {
|
if (PlaceholderAPI.unregisterExpansion(ex)) {
|
||||||
plugin.getLogger().info("Unregistered placeholder expansion: " + ex.getIdentifier());
|
plugin.getLogger().info("Unregistered placeholder expansion: " + ex.getIdentifier());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,15 +138,15 @@ public class PlaceholderListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onQuit(PlayerQuitEvent e) {
|
public void onQuit(PlayerQuitEvent e) {
|
||||||
|
|
||||||
Map<String, PlaceholderHook> placeholders = PlaceholderAPI.getPlaceholders();
|
Set<PlaceholderExpansion> expansions = PlaceholderAPI.getExpansions();
|
||||||
|
|
||||||
if (placeholders.isEmpty()) {
|
if (expansions.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (PlaceholderHook hooks : placeholders.values()) {
|
for (PlaceholderExpansion ex : expansions) {
|
||||||
if (hooks instanceof Cleanable) {
|
if (ex instanceof Cleanable) {
|
||||||
((Cleanable) hooks).cleanup(e.getPlayer());
|
((Cleanable) ex).cleanup(e.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user