mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-12-18 14:57:35 +01:00
Clarify comment
This commit is contained in:
parent
9f7e2915c1
commit
fe626053e6
@ -23,21 +23,21 @@ public class DefaultHolographicDisplaysAPIProvider extends HolographicDisplaysAP
|
||||
private final NMSManager nmsManager;
|
||||
private final PlaceholderRegistry placeholderRegistry;
|
||||
|
||||
// Avoid creating a new instance every time a plugin requires it
|
||||
private final Map<Plugin, HolographicDisplaysAPI> apiCache;
|
||||
// Optimization: avoid creating a new instance every time a plugin requires it, in case it never stores a reference
|
||||
private final Map<Plugin, HolographicDisplaysAPI> apiInstanceCache;
|
||||
|
||||
public DefaultHolographicDisplaysAPIProvider(APIHologramManager apiHologramManager, NMSManager nmsManager, PlaceholderRegistry placeholderRegistry) {
|
||||
this.apiHologramManager = apiHologramManager;
|
||||
this.nmsManager = nmsManager;
|
||||
this.placeholderRegistry = placeholderRegistry;
|
||||
this.apiCache = new WeakHashMap<>();
|
||||
this.apiInstanceCache = new WeakHashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HolographicDisplaysAPI getHolographicDisplaysAPI(Plugin plugin) {
|
||||
Preconditions.notNull(plugin, "plugin");
|
||||
|
||||
return apiCache.computeIfAbsent(plugin, pluginKey ->
|
||||
return apiInstanceCache.computeIfAbsent(plugin, pluginKey ->
|
||||
new DefaultHolographicDisplaysAPI(pluginKey, apiHologramManager, placeholderRegistry));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user