From d9663c5e2b8ad4dae86e343ce68d8ee69dbd1eeb Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 20 Jul 2015 22:42:30 +0300 Subject: [PATCH] Fix handling of changes to PlayerVelocityEvent.velocity by event callers. By: Antony Riley --- paper-server/nms-patches/EntityHuman.patch | 2 +- paper-server/nms-patches/EntityTrackerEntry.patch | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/paper-server/nms-patches/EntityHuman.patch b/paper-server/nms-patches/EntityHuman.patch index 290b643416..fad88539d4 100644 --- a/paper-server/nms-patches/EntityHuman.patch +++ b/paper-server/nms-patches/EntityHuman.patch @@ -315,7 +315,7 @@ + if (event.isCancelled()) { + cancelled = true; + } else if (!velocity.equals(event.getVelocity())) { -+ player.setVelocity(velocity); ++ player.setVelocity(event.getVelocity()); + } + + if (!cancelled) { diff --git a/paper-server/nms-patches/EntityTrackerEntry.patch b/paper-server/nms-patches/EntityTrackerEntry.patch index dda3d64373..0a6cc77920 100644 --- a/paper-server/nms-patches/EntityTrackerEntry.patch +++ b/paper-server/nms-patches/EntityTrackerEntry.patch @@ -89,13 +89,13 @@ + Player player = (Player) this.tracker.getBukkitEntity(); + org.bukkit.util.Vector velocity = player.getVelocity(); + -+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity); ++ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone()); + this.tracker.world.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) { + cancelled = true; + } else if (!velocity.equals(event.getVelocity())) { -+ player.setVelocity(velocity); ++ player.setVelocity(event.getVelocity()); + } + } +