diff options
-rw-r--r-- | README.md | 17 | ||||
-rw-r--r-- | pom.xml | 4 | ||||
-rw-r--r-- | src/main/java/dev/genbyte/sunfright/Damager.java | 11 | ||||
-rw-r--r-- | src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java | 1 |
4 files changed, 22 insertions, 11 deletions
diff --git a/README.md b/README.md index a6e59eb..0e80d07 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ your ability to be in sunlight. [404]: https://www.minecraftforum.net/forums/minecraft-java-edition/seeds/298932-ironman-challenge-series-404 -Every time you spawn, you're given a leather helmet with Curse of Binding and -Curse of Vanishing. This gives you some time to gather supplies before you can -shield yourself from the sunlight. If you try to take it off, it will vanish. -This leather helmet gives you around 5 minutes to gather everything you need to -live a good life underground, or return home. +Every time you spawn, you're given a leather helmet with Curse of Binding, +Curse of Vanishing, and Fire Protection. This gives you some time to gather +supplies before you can shield yourself from the sunlight, but if you try to +take it off, it'll vanish. This leather helmet gives you around 5 minutes to +gather everything you need to live a good life underground, or return home. Normal helmets give you resistance to the sunlight too. Every second you are exposed to skylight greater than 3, your helmet takes one damage, or if you @@ -29,8 +29,9 @@ from the [Minecraft wiki][mcwiki-helmets], is listed below. ### TODO: - Black Stained Glass to shield the sun -- Fire Protection to act like unbreaking -- Respawn helmet disappears when no longer exposed to sunlight. +- Higher levels of Fire Protection give more resistance to the sun (like + unbreaking on the helmet). +- ~~Respawn helmet disappears when no longer exposed to sunlight.~~ DONE! - Allow custom death messages when players burnt by the sun -- ~~Configure damage taken by sun~~ Done! +- ~~Configure damage taken by sun~~ DONE! - Option to adjust by difficulty diff --git a/pom.xml b/pom.xml index dbdd9c8..fd07c3a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,10 +6,10 @@ <groupId>dev.genbyte.sunfright</groupId> <artifactId>sunfright</artifactId> <packaging>jar</packaging> - <version>0.2.2</version> + <version>0.3.0</version> <name>sunfright</name> - <description>Burn me to a cript, large glowing orb!</description> + <description>Burn me to a crisp, large glowing orb!</description> <url>https://genbyte.dev</url><!-- TODO: add URL --> <developers> diff --git a/src/main/java/dev/genbyte/sunfright/Damager.java b/src/main/java/dev/genbyte/sunfright/Damager.java index 8c223fb..42d6133 100644 --- a/src/main/java/dev/genbyte/sunfright/Damager.java +++ b/src/main/java/dev/genbyte/sunfright/Damager.java @@ -51,6 +51,11 @@ public class Damager extends BukkitRunnable { Damageable helmetDamageable = (Damageable) helmetMeta; int helmetDamage = helmetDamageable.getDamage(); + if (helmet.getEnchantmentLevel(Enchantment.PROTECTION_FIRE) < 1) { + applyDamage(); + return; + } + if (helmetDamage + damage >= helmet.getType().getMaxDurability()) { if (helmet.getEnchantmentLevel(Enchantment.VANISHING_CURSE) == 2) { int bindLevel = helmet.getEnchantmentLevel(Enchantment.BINDING_CURSE); @@ -71,8 +76,12 @@ public class Damager extends BukkitRunnable { } } } else { - player.damage(damage * 2); + applyDamage(); } } + + private void applyDamage() { + player.damage(damage * 2); + } } } diff --git a/src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java b/src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java index 5f57cef..c164536 100644 --- a/src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java +++ b/src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java @@ -17,6 +17,7 @@ public class HelmetHandler implements Listener { ItemStack stack = new ItemStack(Material.LEATHER_HELMET); stack.addUnsafeEnchantment(Enchantment.BINDING_CURSE, 1); stack.addUnsafeEnchantment(Enchantment.VANISHING_CURSE, 2); + stack.addEnchantment(Enchantment.PROTECTION_FIRE, 1); inv.setHelmet(stack); } |