From be6be4bb98ec11400e71d9e7021b84ebae3f9df2 Mon Sep 17 00:00:00 2001 From: sepulzera Date: Sun, 24 Oct 2021 14:11:41 +0200 Subject: [PATCH] Reset player velocity on select teleports. Sets the player fall-distance to 0 before performing a player teleport during "move player" steps. This should cancel out the any fall damage that may have built up before the teleport was initiated. Fixes #698 Co-authored-by: Andreas Troelsen --- changelog.md | 1 + .../java/com/garbagemule/MobArena/steps/MovePlayerStep.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/changelog.md b/changelog.md index d998fd0..1e6076c 100644 --- a/changelog.md +++ b/changelog.md @@ -34,6 +34,7 @@ These changes will (most likely) be included in the next version. - Arena Signs now correctly update for arenas that don't have `kebab-case` names in the config-file. - Block explosion events cancelled by other plugins now remain cancelled unless MobArena specifically uncancels them for an arena. - Flaming arrows now ignite TNT blocks in the arena. +- Players no longer take fall damage when they leave (or get removed from) an arena while falling. ## [0.106] - 2021-05-09 ### Added diff --git a/src/main/java/com/garbagemule/MobArena/steps/MovePlayerStep.java b/src/main/java/com/garbagemule/MobArena/steps/MovePlayerStep.java index 5a82aea..8054b70 100644 --- a/src/main/java/com/garbagemule/MobArena/steps/MovePlayerStep.java +++ b/src/main/java/com/garbagemule/MobArena/steps/MovePlayerStep.java @@ -19,11 +19,13 @@ abstract class MovePlayerStep extends PlayerStep { public void run() { location = player.getLocation(); + player.setFallDistance(0); player.teleport(destination.get()); } @Override public void undo() { + player.setFallDistance(0); player.teleport(location); } }