From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TreyRuffy <TreyRuffy@users.noreply.github.com>
Date: Wed, 9 Jun 2021 16:31:14 -0600
Subject: [PATCH] Flying Fall Damage API


diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 24523dd712329f2f3abe40bb3f1801ef7946e831..ebd744b08e27d6fc6dda31ada7ad8bb1864a6982 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -183,6 +183,7 @@ public abstract class Player extends LivingEntity {
     public boolean affectsSpawning = true;
     // Paper end
     public boolean isCritical = false; // Purpur
+    public boolean flyingFallDamage = false; // Purpur
 
     // CraftBukkit start
     public boolean fauxSleeping;
@@ -1730,7 +1731,7 @@ public abstract class Player extends LivingEntity {
 
     @Override
     public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) {
-        if (this.abilities.mayfly) {
+        if (this.abilities.mayfly && !flyingFallDamage) { // Purpur
             return false;
         } else {
             if (fallDistance >= 2.0F) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e409c6c4f4da1cb2d4a42971dbc362a258a51d3b..0c1d64731c3c9581b0cf9b720057ef07be4f764e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2600,5 +2600,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
     public void setSpawnInvulnerableTicks(int spawnInvulnerableTime) {
         getHandle().spawnInvulnerableTime = spawnInvulnerableTime;
     }
+
+    public void setFlyingFallDamage(boolean flyingFallDamage) {
+        getHandle().flyingFallDamage = flyingFallDamage;
+    }
+
+    @Override
+    public boolean hasFlyingFallDamage() {
+        return getHandle().flyingFallDamage;
+    }
     // Purpur end
 }
