Fixed cache clearing task being cancelled
This commit is contained in:
@@ -101,6 +101,11 @@ public class EcoEnchantsPlugin extends EcoPlugin {
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
this.getScheduler().runTimer(() -> {
|
||||
for (EcoEnchant enchant : EcoEnchants.values()) {
|
||||
enchant.clearCachedRequirements();
|
||||
}
|
||||
}, 300, 300);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -263,8 +263,7 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche
|
||||
|
||||
postUpdate();
|
||||
this.register();
|
||||
this.cachedRequirements.clear();
|
||||
this.getPlugin().getScheduler().runTimer(this.cachedRequirements::clear, 300, 300);
|
||||
this.clearCachedRequirements();
|
||||
}
|
||||
|
||||
protected void postUpdate() {
|
||||
@@ -279,6 +278,13 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche
|
||||
EnchantmentUtils.register(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear requirements cache.
|
||||
*/
|
||||
public void clearCachedRequirements() {
|
||||
this.cachedRequirements.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the %value% placeholder in description lore.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user