From 3ef916da77a555215af2d9f7766d57ce5c72b396 Mon Sep 17 00:00:00 2001
From: Warrior <50800980+Warriorrrr@users.noreply.github.com>
Date: Fri, 7 Oct 2022 20:43:26 +0200
Subject: [PATCH] Exempt players in creative/spectator from nether ceiling
 damage (#8427)

---
 patches/server/Configurable-top-of-nether-void-damage.patch | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/patches/server/Configurable-top-of-nether-void-damage.patch b/patches/server/Configurable-top-of-nether-void-damage.patch
index 72028dd1a2..460465bf45 100644
--- a/patches/server/Configurable-top-of-nether-void-damage.patch
+++ b/patches/server/Configurable-top-of-nether-void-damage.patch
@@ -16,7 +16,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        // Paper start - Configurable nether ceiling damage
 +        if (this.getY() < (double) (this.level.getMinBuildHeight() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER
 +            && level.paperConfig().environment.netherCeilingVoidDamageHeight > 0
-+            && this.getY() >= this.level.paperConfig().environment.netherCeilingVoidDamageHeight)) {
++            && this.getY() >= this.level.paperConfig().environment.netherCeilingVoidDamageHeight
++            && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) {
 +            // Paper end
              this.outOfWorld();
          }