mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI.git
synced 2024-12-30 21:07:42 +01:00
Remove useless "expansion cache" that I don't even know ever worked. Intention was to cache any expansion that isn't registered due to the dependency not being loaded yet when expansion registration initialized. Non issue now that registration happens in ServerLoadEvent.
This commit is contained in:
parent
16d0a4f690
commit
c0f6cf225f
@ -22,7 +22,6 @@ package me.clip.placeholderapi.expansion;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@ -36,8 +35,6 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
public final class ExpansionManager {
|
public final class ExpansionManager {
|
||||||
|
|
||||||
private final Map<String, PlaceholderExpansion> cache = new HashMap<>();
|
|
||||||
private PlaceholderAPIPlugin plugin;
|
private PlaceholderAPIPlugin plugin;
|
||||||
|
|
||||||
public ExpansionManager(PlaceholderAPIPlugin instance) {
|
public ExpansionManager(PlaceholderAPIPlugin instance) {
|
||||||
@ -48,18 +45,6 @@ public final class ExpansionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clean() {
|
|
||||||
cache.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlaceholderExpansion getCachedExpansion(String plugin) {
|
|
||||||
return cache.getOrDefault(plugin, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean removeCachedExpansion(String identifier) {
|
|
||||||
return cache.remove(identifier) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlaceholderExpansion getRegisteredExpansion(String name) {
|
public PlaceholderExpansion getRegisteredExpansion(String name) {
|
||||||
for (Entry<String, PlaceholderHook> hook : PlaceholderAPI.getPlaceholders().entrySet()) {
|
for (Entry<String, PlaceholderHook> hook : PlaceholderAPI.getPlaceholders().entrySet()) {
|
||||||
if (hook.getValue() instanceof PlaceholderExpansion) {
|
if (hook.getValue() instanceof PlaceholderExpansion) {
|
||||||
@ -112,9 +97,6 @@ public final class ExpansionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!expansion.canRegister()) {
|
if (!expansion.canRegister()) {
|
||||||
if (expansion.getRequiredPlugin() != null) {
|
|
||||||
cache.put(expansion.getRequiredPlugin().toLowerCase(), expansion);
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!expansion.register()) {
|
if (!expansion.register()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user