mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-23 04:47:34 +01:00
Fixed an issue with item caching
This commit is contained in:
parent
69a8df439b
commit
4b80343d12
@ -147,7 +147,7 @@ public class MMOItems extends JavaPlugin {
|
||||
abilityManager.stopRegistration();
|
||||
|
||||
configManager = new ConfigManager();
|
||||
itemManager = new ItemManager();
|
||||
itemManager = new ItemManager(getConfig().getBoolean("use-item-caching"));
|
||||
tierManager = new TierManager();
|
||||
setManager = new SetManager();
|
||||
upgradeManager = new UpgradeManager();
|
||||
|
@ -15,20 +15,14 @@ import net.Indyuce.mmoitems.api.item.MMOItem;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
|
||||
public class ItemManager extends BukkitRunnable {
|
||||
private Map<Type, Map<String, LoadedItem>> map = new HashMap<>();
|
||||
private boolean cache = false;
|
||||
private final Map<Type, Map<String, LoadedItem>> map = new HashMap<>();
|
||||
private final boolean cache;
|
||||
|
||||
public ItemManager() {
|
||||
runTaskTimerAsynchronously(MMOItems.plugin, 60 * 20, 2 * 60 * 20);
|
||||
}
|
||||
|
||||
public void useCache(boolean cache) {
|
||||
public ItemManager(boolean cache) {
|
||||
this.cache = cache;
|
||||
if (!cache) {
|
||||
map.clear();
|
||||
if (!isCancelled())
|
||||
cancel();
|
||||
}
|
||||
|
||||
if (cache)
|
||||
runTaskTimerAsynchronously(MMOItems.plugin, 60 * 20, 2 * 60 * 20);
|
||||
}
|
||||
|
||||
public void uncache(Type type, String id) {
|
||||
|
Loading…
Reference in New Issue
Block a user