Fixed EnchantRegrowth and EnchantSaturation
This commit is contained in:
parent
3c0473330e
commit
d9d2a84805
@ -40,25 +40,30 @@ public class EnchantRegrowth extends ExcellentEnchant implements PassiveEnchant,
|
|||||||
public EnchantRegrowth(@NotNull ExcellentEnchants plugin) {
|
public EnchantRegrowth(@NotNull ExcellentEnchants plugin) {
|
||||||
super(plugin, ID, EnchantPriority.MEDIUM);
|
super(plugin, ID, EnchantPriority.MEDIUM);
|
||||||
|
|
||||||
this.task = new Task(plugin);
|
|
||||||
this.task.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadConfig() {
|
public void loadConfig() {
|
||||||
super.loadConfig();
|
super.loadConfig();
|
||||||
this.healInterval = JOption.create("Settings.Heal.Interval", 100,
|
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",
|
this.healMinHealth = EnchantScaler.read(this, "Settings.Heal.Min_Health", "0.5",
|
||||||
"Minimal entity health for the enchantment to have effect.");
|
"Minimal entity health for the enchantment to have effect.");
|
||||||
this.healMaxHealth = EnchantScaler.read(this, "Settings.Heal.Max_Health", "20.0",
|
this.healMaxHealth = EnchantScaler.read(this, "Settings.Heal.Max_Health", "20.0",
|
||||||
"Maximal entity health when the enchantment will not heal anymore.");
|
"Maximal entity health when the enchantment will not heal anymore.");
|
||||||
this.healAmount = EnchantScaler.read(this, "Settings.Heal.Amount", "0.25",
|
this.healAmount = EnchantScaler.read(this, "Settings.Heal.Amount", "0.25",
|
||||||
"Amount of hearts to be restored.");
|
"Amount of hearts to be restored.");
|
||||||
|
|
||||||
|
this.task = new Task(plugin);
|
||||||
|
this.task.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
|
this.stopTask();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopTask() {
|
||||||
if (this.task != null) {
|
if (this.task != null) {
|
||||||
this.task.stop();
|
this.task.stop();
|
||||||
this.task = null;
|
this.task = null;
|
||||||
|
@ -35,24 +35,28 @@ public class EnchantSaturation extends ExcellentEnchant implements PassiveEnchan
|
|||||||
|
|
||||||
public EnchantSaturation(@NotNull ExcellentEnchants plugin) {
|
public EnchantSaturation(@NotNull ExcellentEnchants plugin) {
|
||||||
super(plugin, ID, EnchantPriority.MEDIUM);
|
super(plugin, ID, EnchantPriority.MEDIUM);
|
||||||
|
|
||||||
this.task = new Task(plugin);
|
|
||||||
this.task.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadConfig() {
|
public void loadConfig() {
|
||||||
super.loadConfig();
|
super.loadConfig();
|
||||||
this.saturationInterval = JOption.create("Settings.Saturation.Interval", 100,
|
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,
|
this.saturationAmount = EnchantScaler.read(this, "Settings.Saturation.Amount", Placeholders.ENCHANTMENT_LEVEL,
|
||||||
"Amount of food points to restore.");
|
"Amount of food points to restore.");
|
||||||
this.saturationMaxFoodLevel = EnchantScaler.read(this, "Settings.Saturation.Max_Food_Level", "20",
|
this.saturationMaxFoodLevel = EnchantScaler.read(this, "Settings.Saturation.Max_Food_Level", "20",
|
||||||
"Maximal player's food level for the enchantment to stop feeding them.");
|
"Maximal player's food level for the enchantment to stop feeding them.");
|
||||||
|
|
||||||
|
this.task = new Task(plugin);
|
||||||
|
this.task.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
|
this.stopTask();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopTask() {
|
||||||
if (this.task != null) {
|
if (this.task != null) {
|
||||||
this.task.stop();
|
this.task.stop();
|
||||||
this.task = null;
|
this.task = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user