about summary refs log tree commit diff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/dev/genbyte/sunfright/Damager.java3
-rw-r--r--src/main/java/dev/genbyte/sunfright/Sunfright.java7
-rw-r--r--src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java2
-rw-r--r--src/main/resources/config.yml3
4 files changed, 12 insertions, 3 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;
 		}
 
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 9f7bcd9..ff6c3ff 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -1,2 +1,3 @@
 world: world
-damagePerSecond: 2
\ No newline at end of file
+damagePerSecond: 2
+enableRespawnHelmet: true
\ No newline at end of file