diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/dev/nyble/sunfright/Damager.java | 18 | ||||
-rw-r--r-- | src/main/java/dev/nyble/sunfright/Sunfright.java | 6 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/main/java/dev/nyble/sunfright/Damager.java b/src/main/java/dev/nyble/sunfright/Damager.java index 890bb98..6158627 100644 --- a/src/main/java/dev/nyble/sunfright/Damager.java +++ b/src/main/java/dev/nyble/sunfright/Damager.java @@ -2,6 +2,7 @@ package dev.nyble.sunfright; import java.util.Collection; import java.util.Random; +import java.util.logging.Level; import org.bukkit.Location; import org.bukkit.Material; @@ -43,14 +44,17 @@ public class Damager extends BukkitRunnable { Block current = sunnedWorld.getBlockAt(x, i, z); if (!blockShouldDamage(current.getType())) { + int skylight = player.getLocation().getBlock().getLightFromSky(); + /* - * player rulled to be safe. Remove their helmet if it's the one we gave, but + * player ruled to be safe. Remove their helmet if it's the one we gave, but * only do so if the skylight is less than three. This will keep us from * removing the starter helmet if they're just chopping down a tree */ if (player.getInventory().getHelmet() != null && - player.getLocation().getBlock().getLightFromSky() > 3 && + skylight < 3 && player.getInventory().getHelmet().getEnchantmentLevel(Enchantment.VANISHING_CURSE) == 2) { + sf.getLogger().info("Took helmet from " + player.getName() + " at light level " + skylight); player.getInventory().setHelmet(new ItemStack(Material.AIR)); } @@ -58,7 +62,7 @@ public class Damager extends BukkitRunnable { } } - new DoDamage(player, sf.damagaPerSecond).runTask(sf); + new DoDamage(player, sf.damagePerSecond).runTask(sf); }); } @@ -69,9 +73,8 @@ public class Damager extends BukkitRunnable { boolean storming = sunnedWorld.hasStorm(); boolean thundering = sunnedWorld.isThundering(); - // Times are pulled from Minecraft Gamepedia page on Light, specifically the - // internal light - // level section. https://minecraft.gamepedia.com/Light + // Times are pulled Minecraft.wiki page on Light, specifically the + // internal light level section. https://minecraft.wiki/Light // Times correspond to when the light level is over 8. if (storming && !thundering) { if (time >= 12734 && time <= 23266) { @@ -92,8 +95,7 @@ public class Damager extends BukkitRunnable { * things. This function * checks if a material lets light pass and should damage the player. * I've never seen it give a false positive, only a false negative, so it is one - * of the first - * things we check. + * of the first things we check. */ @SuppressWarnings("deprecation") private boolean blockShouldDamage(Material mat) { diff --git a/src/main/java/dev/nyble/sunfright/Sunfright.java b/src/main/java/dev/nyble/sunfright/Sunfright.java index 6661ab6..76645c2 100644 --- a/src/main/java/dev/nyble/sunfright/Sunfright.java +++ b/src/main/java/dev/nyble/sunfright/Sunfright.java @@ -10,7 +10,7 @@ import dev.nyble.sunfright.events.HelmetHandler; public class Sunfright extends JavaPlugin { public World sunnedWorld; - public int damagaPerSecond; + public int damagePerSecond; public boolean respawnHelmetEnabled; private BukkitTask damager; @@ -37,7 +37,7 @@ public class Sunfright extends JavaPlugin { this.saveDefaultConfig(); String world = getConfig().getString("world"); - damagaPerSecond = getConfig().getInt("damagePerSecond"); + damagePerSecond = getConfig().getInt("damagePerSecond"); sunnedWorld = getServer().getWorld(world); if (sunnedWorld == null) { @@ -45,7 +45,7 @@ public class Sunfright extends JavaPlugin { return false; } - if (damagaPerSecond == 0) { + if (damagePerSecond == 0) { getLogger().log(Level.WARNING, "damagePerSecond is 0. Was this intended?"); } |