diff --git a/varo/src/main/java/de/cliffbreak/varo/Varo.java b/varo/src/main/java/de/cliffbreak/varo/Varo.java index c788fd3..5c420be 100644 --- a/varo/src/main/java/de/cliffbreak/varo/Varo.java +++ b/varo/src/main/java/de/cliffbreak/varo/Varo.java @@ -50,8 +50,9 @@ public class Varo extends JavaPlugin { this.banUtils = new BanUtils(this); this.varoUtils = new VaroUtils(this); - // this.config.addDefault("Varo.Start", "TODO: StartDate"); + this.config.addDefault("Varo.Start", "25.05.2020"); this.config.addDefault("Varo.Debug", false); + this.config.addDefault("Varo.RetroHealthRegen", false); this.config.addDefault("Varo.Bans", new ArrayList()); this.config.options().copyDefaults(true); this.saveConfig(); @@ -61,7 +62,7 @@ public class Varo extends JavaPlugin { this.getServer().getPluginManager().registerEvents(new PlayerClientOptionsChangeListener(this), this); this.getServer().getPluginManager().registerEvents(new PlayerResourcePackStatusListener(), this); this.getServer().getPluginManager().registerEvents(new ChatListener(), this); - this.getServer().getPluginManager().registerEvents(new EntityRegainHealthListener(), this); + this.getServer().getPluginManager().registerEvents(new EntityRegainHealthListener(this), this); this.getServer().getPluginManager().registerEvents(new PlayerDeathListener(this), this); this.getServer().getPluginManager().registerEvents(new BannedItemListener(), this); this.getServer().getPluginManager().registerEvents(new BannedActionListener(this), this); diff --git a/varo/src/main/java/de/cliffbreak/varo/listeners/EntityRegainHealthListener.java b/varo/src/main/java/de/cliffbreak/varo/listeners/EntityRegainHealthListener.java index 874cdb7..0592fd0 100644 --- a/varo/src/main/java/de/cliffbreak/varo/listeners/EntityRegainHealthListener.java +++ b/varo/src/main/java/de/cliffbreak/varo/listeners/EntityRegainHealthListener.java @@ -5,13 +5,23 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityRegainHealthEvent; +import de.cliffbreak.varo.Varo; + public class EntityRegainHealthListener implements Listener { + private final Varo plugin; + + public EntityRegainHealthListener(final Varo plugin) { + this.plugin = plugin; + } + @EventHandler public void onEntityRegainHealth(final EntityRegainHealthEvent e) { if (e.getEntity() instanceof Player) { - if (e.isFastRegen()) { - e.setAmount(0.13d); + if (this.plugin.getConfig().getBoolean("Varo.RetroHealthRegen")) { + if (e.isFastRegen()) { + e.setAmount(0.13d); + } } } }