diff options
author | Genny <gen@nyble.dev> | 2020-02-03 20:54:34 -0600 |
---|---|---|
committer | Genny <gen@nyble.dev> | 2020-02-03 20:54:34 -0600 |
commit | 757c84a8559a4002d1b8b47af6364c3b4e565fec (patch) | |
tree | 38a2d40e9825024037cac382b426ed620f07d598 /src | |
parent | e6a6a283259f947226527206cc36fd4b2e92a3aa (diff) | |
download | sunfright-757c84a8559a4002d1b8b47af6364c3b4e565fec.tar.gz sunfright-757c84a8559a4002d1b8b47af6364c3b4e565fec.zip |
2x player damage and respawn helmet removal
The player will now take twice the damage as the helmet will. Respawn helments now vanish when in a safe area.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/dev/genbyte/sunfright/Damager.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/dev/genbyte/sunfright/Damager.java b/src/main/java/dev/genbyte/sunfright/Damager.java index 6eb7c4d..8c223fb 100644 --- a/src/main/java/dev/genbyte/sunfright/Damager.java +++ b/src/main/java/dev/genbyte/sunfright/Damager.java @@ -20,10 +20,14 @@ public class Damager extends BukkitRunnable { public void run() { Collection<? extends Player> players = sf.getServer().getOnlinePlayers(); + players.forEach((player) -> { byte skylight = player.getLocation().getBlock().getLightFromSky(); + if (skylight > 3) { new DoDamage(player, (byte) 1).runTask(sf); + } else if (player.getInventory().getHelmet().getEnchantmentLevel(Enchantment.VANISHING_CURSE) == 2) { + player.getInventory().setHelmet(new ItemStack(Material.AIR)); } }); } @@ -67,7 +71,7 @@ public class Damager extends BukkitRunnable { } } } else { - player.damage(damage); + player.damage(damage * 2); } } } |