feat: add config option to disable FastRegen
This commit is contained in:
parent
507b858587
commit
037f0641cc
2 changed files with 15 additions and 4 deletions
|
@ -50,8 +50,9 @@ public class Varo extends JavaPlugin {
|
||||||
this.banUtils = new BanUtils(this);
|
this.banUtils = new BanUtils(this);
|
||||||
this.varoUtils = new VaroUtils(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.Debug", false);
|
||||||
|
this.config.addDefault("Varo.RetroHealthRegen", false);
|
||||||
this.config.addDefault("Varo.Bans", new ArrayList<String>());
|
this.config.addDefault("Varo.Bans", new ArrayList<String>());
|
||||||
this.config.options().copyDefaults(true);
|
this.config.options().copyDefaults(true);
|
||||||
this.saveConfig();
|
this.saveConfig();
|
||||||
|
@ -61,7 +62,7 @@ public class Varo extends JavaPlugin {
|
||||||
this.getServer().getPluginManager().registerEvents(new PlayerClientOptionsChangeListener(this), this);
|
this.getServer().getPluginManager().registerEvents(new PlayerClientOptionsChangeListener(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new PlayerResourcePackStatusListener(), this);
|
this.getServer().getPluginManager().registerEvents(new PlayerResourcePackStatusListener(), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new ChatListener(), 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 PlayerDeathListener(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new BannedItemListener(), this);
|
this.getServer().getPluginManager().registerEvents(new BannedItemListener(), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new BannedActionListener(this), this);
|
this.getServer().getPluginManager().registerEvents(new BannedActionListener(this), this);
|
||||||
|
|
|
@ -5,13 +5,23 @@ import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
|
|
||||||
|
import de.cliffbreak.varo.Varo;
|
||||||
|
|
||||||
public class EntityRegainHealthListener implements Listener {
|
public class EntityRegainHealthListener implements Listener {
|
||||||
|
|
||||||
|
private final Varo plugin;
|
||||||
|
|
||||||
|
public EntityRegainHealthListener(final Varo plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityRegainHealth(final EntityRegainHealthEvent e) {
|
public void onEntityRegainHealth(final EntityRegainHealthEvent e) {
|
||||||
if (e.getEntity() instanceof Player) {
|
if (e.getEntity() instanceof Player) {
|
||||||
if (e.isFastRegen()) {
|
if (this.plugin.getConfig().getBoolean("Varo.RetroHealthRegen")) {
|
||||||
e.setAmount(0.13d);
|
if (e.isFastRegen()) {
|
||||||
|
e.setAmount(0.13d);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue