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 /src/main/java | |
parent | 2ada0604ae3dcaf608547ae642496c360ad53869 (diff) | |
download | sunfright-94faaad338f884868f92d3b3e74ae0d1f6d16d09.tar.gz sunfright-94faaad338f884868f92d3b3e74ae0d1f6d16d09.zip |
Implement sunlight filtering with black glass
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/dev/genbyte/sunfright/Damager.java | 8 |
1 files changed, 8 insertions, 0 deletions
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(); |