about summary refs log tree commit diff
path: root/src/main/java/dev/genbyte/sunfright/Damager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/dev/genbyte/sunfright/Damager.java')
-rw-r--r--src/main/java/dev/genbyte/sunfright/Damager.java8
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();