From 3c811ed5bb5dfb4db324da160a54fe2e5d47ff78 Mon Sep 17 00:00:00 2001 From: mooziii <63669478+mooziii@users.noreply.github.com> Date: Tue, 12 Apr 2022 11:55:57 +0200 Subject: [PATCH] Add Entity.isStandingOnBlock --- .../axay/kspigot/extensions/bukkit/EntityExtensions.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt b/src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt index 881218ef..afbf071b 100644 --- a/src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt +++ b/src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt @@ -42,6 +42,14 @@ val Entity.isGroundSolid: Boolean get() = this.location.add(0.0, -0.01, 0.0).blo */ val Entity.groundMaterial get() = this.location.add(0.0, -0.01, 0.0).block.type +/** + * @returns true if the entity is supported by a block. + * The method from bukkit is deprecated because it can be spoofed by the client. + * This can't be spoofed. + */ +val Entity.isStandingOnBlock: Boolean + get() = groundMaterial.isSolid + /** * @return The max health of the entity * @throws NullPointerException if the entity doesn't have a max health value