diff options
Diffstat (limited to 'src/main/java/dev')
-rw-r--r-- | src/main/java/dev/genbyte/sunfright/Damager.java | 3 | ||||
-rw-r--r-- | src/main/java/dev/genbyte/sunfright/Sunfright.java | 7 | ||||
-rw-r--r-- | src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/dev/genbyte/sunfright/Damager.java b/src/main/java/dev/genbyte/sunfright/Damager.java index 038295d..4ee7615 100644 --- a/src/main/java/dev/genbyte/sunfright/Damager.java +++ b/src/main/java/dev/genbyte/sunfright/Damager.java @@ -148,7 +148,8 @@ public class Damager extends BukkitRunnable { int chanceToDamage = 60 + (40 / (fireProtLevel)); if (rand.nextInt(99)+1 <= chanceToDamage) { - helmetDamageable.setDamage(helmetDamage + (damage/2)); + int calculatedDamage = (int) Math.ceil(damage / 2); + helmetDamageable.setDamage(helmetDamage + calculatedDamage); helmet.setItemMeta((ItemMeta) helmetDamageable); } } diff --git a/src/main/java/dev/genbyte/sunfright/Sunfright.java b/src/main/java/dev/genbyte/sunfright/Sunfright.java index 6404360..13dfa69 100644 --- a/src/main/java/dev/genbyte/sunfright/Sunfright.java +++ b/src/main/java/dev/genbyte/sunfright/Sunfright.java @@ -11,6 +11,7 @@ import dev.genbyte.sunfright.events.HelmetHandler; public class Sunfright extends JavaPlugin { public World sunnedWorld; public int damagaPerSecond; + public boolean respawnHelmetEnabled; private BukkitTask damager; @Override @@ -48,6 +49,12 @@ public class Sunfright extends JavaPlugin { getLogger().log(Level.WARNING, "damagePerSecond is 0. Was this intended?"); } + if (getConfig().isSet("enableRespawnHelmet")) { + respawnHelmetEnabled = getConfig().getBoolean("enableRespawnHelmet"); + } else { + getLogger().log(Level.WARNING, "enableRespawnHelmet was not set! Defaulting to true!"); + } + return true; } } \ No newline at end of file diff --git a/src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java b/src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java index 739ee78..6c8afc9 100644 --- a/src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java +++ b/src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java @@ -45,7 +45,7 @@ public class HelmetHandler implements Listener { } private void setRespawnHelmet(Player player) { - if (!player.getWorld().equals(sf.sunnedWorld)) { + if (!sf.respawnHelmetEnabled || !player.getWorld().equals(sf.sunnedWorld)) { return; } |