diff options
author | Genny <gen@nyble.dev> | 2020-02-21 01:00:43 -0600 |
---|---|---|
committer | Genny <gen@nyble.dev> | 2020-02-21 01:00:43 -0600 |
commit | 94faaad338f884868f92d3b3e74ae0d1f6d16d09 (patch) | |
tree | a2f352b8e3944437277471487991ea9c4e6e8be1 | |
parent | 2ada0604ae3dcaf608547ae642496c360ad53869 (diff) | |
download | sunfright-94faaad338f884868f92d3b3e74ae0d1f6d16d09.tar.gz sunfright-94faaad338f884868f92d3b3e74ae0d1f6d16d09.zip |
Implement sunlight filtering with black glass
-rw-r--r-- | README.md | 18 | ||||
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | src/main/java/dev/genbyte/sunfright/Damager.java | 8 | ||||
-rw-r--r-- | src/main/resources/plugin.yml | 1 |
4 files changed, 19 insertions, 10 deletions
diff --git a/README.md b/README.md index 0e80d07..a7d0f37 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # Sunfright +[todo.sr.ht][tickets] + +[tickets]: https://todo.sr.ht/~genbyte/sunfright + Inspired by the [404 challenge][404], this is a Spigot plugin that restricts your ability to be in sunlight. @@ -26,12 +30,8 @@ from the [Minecraft wiki][mcwiki-helmets], is listed below. [mcwiki-helmets]: https://minecraft.gamepedia.com/Helmet#Durability -### TODO: - -- Black Stained Glass to shield the sun -- 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! -- Option to adjust by difficulty +### Notes +- Black glass can shield you from the sun if it is directly above you. +- Respawn helmets disappear when you are safe. +- You must have at least Fire Protection I on a helmet to stay safe from + sunlight above level 3. diff --git a/pom.xml b/pom.xml index 7e3c1b9..d35225e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ <groupId>dev.genbyte.sunfright</groupId> <artifactId>sunfright</artifactId> <packaging>jar</packaging> - <version>0.3.1</version> + <version>0.4.0</version> <name>sunfright</name> <description>Burn me to a crisp, large glowing orb!</description> diff --git a/src/main/java/dev/genbyte/sunfright/Damager.java b/src/main/java/dev/genbyte/sunfright/Damager.java index 42d6133..bfb977f 100644 --- a/src/main/java/dev/genbyte/sunfright/Damager.java +++ b/src/main/java/dev/genbyte/sunfright/Damager.java @@ -4,6 +4,7 @@ import java.util.Collection; import java.util.logging.Level; import org.bukkit.Material; +import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -43,6 +44,13 @@ public class Damager extends BukkitRunnable { public void run() { ItemStack helmet = player.getInventory().getHelmet(); + Block topBlock = player.getWorld().getBlockAt( + player.getWorld().getHighestBlockAt(player.getLocation()).getLocation().subtract(0, 1, 0)); + + if (topBlock.getLocation().getY() > player.getLocation().getY() + && topBlock.getType().equals(Material.BLACK_STAINED_GLASS)) { + return; + } if (helmet != null) { ItemMeta helmetMeta = helmet.getItemMeta(); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 991a8e4..c26f3ca 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -4,4 +4,5 @@ description: ${description} author: ${author} website: ${url} +api-version: 1.13 main: ${mainClass} \ No newline at end of file |