diff --git a/Spigot-API-Patches/PlayerMoveEvent-Improvements.patch b/Spigot-API-Patches/PlayerMoveEvent-Improvements.patch index 9d2cf5d4c..477be49ae 100644 --- a/Spigot-API-Patches/PlayerMoveEvent-Improvements.patch +++ b/Spigot-API-Patches/PlayerMoveEvent-Improvements.patch @@ -14,31 +14,49 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - PlayerMoveEvent improvements + /** -+ * Check if the player has changed position in the event -+ * ++ * Check if the player has changed position (even within the same block) in the event ++ * + * @return whether the player has changed position or not + */ + public boolean hasChangedPosition() { ++ return hasExplicitlyChangedPosition() || !from.getWorld().equals(to.getWorld()); ++ } ++ ++ /** ++ * Check if the player has changed position (even within the same block) in the event, disregarding a possible world change ++ * ++ * @return whether the player has changed position or not ++ */ ++ public boolean hasExplicitlyChangedPosition() { + return from.getX() != to.getX() || from.getY() != to.getY() || from.getZ() != to.getZ(); + } + + /** ++ * Check if the player has moved to a new block in the event ++ * ++ * @return whether the player has moved to a new block or not ++ */ ++ public boolean hasChangedBlock() { ++ return hasExplicitlyChangedBlock() || !from.getWorld().equals(to.getWorld()); ++ } ++ ++ /** ++ * Check if the player has moved to a new block in the event, disregarding a possible world change ++ * ++ * @return whether the player has moved to a new block or not ++ */ ++ public boolean hasExplicitlyChangedBlock() { ++ return from.getBlockX() != to.getBlockX() || from.getBlockY() != to.getBlockY() || from.getBlockZ() != to.getBlockZ(); ++ } ++ ++ /** + * Check if the player has changed orientation in the event -+ * ++ * + * @return whether the player has changed orientation or not + */ + public boolean hasChangedOrientation() { + return from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw(); + } -+ -+ /** -+ * Check if the player has changed to a new block in the event -+ * -+ * @return whether the player has changed block or not -+ */ -+ public boolean hasChangedBlock() { -+ return from.getBlockX() != to.getBlockX() || from.getBlockY() != to.getBlockY() || from.getBlockZ() != to.getBlockZ(); -+ } + // Paper end + private void validateLocation(@NotNull Location loc) {