diff options
author | gennyble <gen@nyble.dev> | 2023-11-08 23:22:05 -0600 |
---|---|---|
committer | gennyble <gen@nyble.dev> | 2023-11-08 23:22:05 -0600 |
commit | c468660c874a189c5037830cc0fcec1c0fd37697 (patch) | |
tree | 4900946137772185f1dad583d12be2212516e9b3 | |
parent | 972080d052b878c0a296d040b5dba2a973b7570f (diff) | |
download | sunfright-1.0.1.tar.gz sunfright-1.0.1.zip |
i got a comparison sign backwards, lol
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | pom.xml | 4 | ||||
-rw-r--r-- | src/main/java/dev/nyble/sunfright/Damager.java | 18 | ||||
-rw-r--r-- | src/main/java/dev/nyble/sunfright/Sunfright.java | 6 |
4 files changed, 17 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore index edd2fa2..81b88c2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ # Java things .project .classpath +# jenv +.java-version # Maven things target/ diff --git a/pom.xml b/pom.xml index b499a75..ff2d56f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ <groupId>dev.nyble.sunfright</groupId> <artifactId>Sunfright</artifactId> <packaging>jar</packaging> - <version>1.0.0</version> + <version>1.0.1</version> <name>Sunfright</name> <description>Burn me to a crisp, large glowing orb!</description> @@ -46,7 +46,7 @@ <build> <sourceDirectory>src/main/java</sourceDirectory> - <defaultGoal>clean install</defaultGoal> + <defaultGoal>clean package</defaultGoal> <resources> <resource> 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?"); } |