diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantRegrowth.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantRegrowth.java index 5cd62d9..c7b6773 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantRegrowth.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantRegrowth.java @@ -40,25 +40,30 @@ public class EnchantRegrowth extends ExcellentEnchant implements PassiveEnchant, public EnchantRegrowth(@NotNull ExcellentEnchants plugin) { super(plugin, ID, EnchantPriority.MEDIUM); - this.task = new Task(plugin); - this.task.start(); } @Override public void loadConfig() { super.loadConfig(); this.healInterval = JOption.create("Settings.Heal.Interval", 100, - "How often (in seconds) enchantment will have effect?").read(cfg); + "How often (in ticks) enchantment will have effect? 1 second = 20 ticks.").read(cfg); this.healMinHealth = EnchantScaler.read(this, "Settings.Heal.Min_Health", "0.5", "Minimal entity health for the enchantment to have effect."); this.healMaxHealth = EnchantScaler.read(this, "Settings.Heal.Max_Health", "20.0", "Maximal entity health when the enchantment will not heal anymore."); this.healAmount = EnchantScaler.read(this, "Settings.Heal.Amount", "0.25", "Amount of hearts to be restored."); + + this.task = new Task(plugin); + this.task.start(); } @Override public void clear() { + this.stopTask(); + } + + private void stopTask() { if (this.task != null) { this.task.stop(); this.task = null; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantSaturation.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantSaturation.java index e614163..0d8b156 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantSaturation.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantSaturation.java @@ -35,24 +35,28 @@ public class EnchantSaturation extends ExcellentEnchant implements PassiveEnchan public EnchantSaturation(@NotNull ExcellentEnchants plugin) { super(plugin, ID, EnchantPriority.MEDIUM); - - this.task = new Task(plugin); - this.task.start(); } @Override public void loadConfig() { super.loadConfig(); this.saturationInterval = JOption.create("Settings.Saturation.Interval", 100, - "How often (in seconds) enchantment will have effect?").read(cfg); + "How often (in ticks) enchantment will have effect? 1 second = 20 ticks.").read(cfg); this.saturationAmount = EnchantScaler.read(this, "Settings.Saturation.Amount", Placeholders.ENCHANTMENT_LEVEL, "Amount of food points to restore."); this.saturationMaxFoodLevel = EnchantScaler.read(this, "Settings.Saturation.Max_Food_Level", "20", "Maximal player's food level for the enchantment to stop feeding them."); + + this.task = new Task(plugin); + this.task.start(); } @Override public void clear() { + this.stopTask(); + } + + private void stopTask() { if (this.task != null) { this.task.stop(); this.task = null;