mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +01:00
Use the result of EntityPortalExitEvent. Fixes BUKKIT-3559.
This commit is contained in:
parent
1090e0cf46
commit
94da64ee93
1 changed files with 12 additions and 4 deletions
|
@ -301,11 +301,19 @@ public class PortalTravelAgent {
|
|||
this.a.getServer().getPluginManager().callEvent(event);
|
||||
Location to = event.getTo();
|
||||
if (event.isCancelled() || to == null || !entity.isAlive()) {
|
||||
position = from;
|
||||
velocity = before;
|
||||
position.setX(from.getX());
|
||||
position.setY(from.getY());
|
||||
position.setZ(from.getZ());
|
||||
position.setYaw(from.getYaw());
|
||||
position.setPitch(from.getPitch());
|
||||
velocity.copy(before);
|
||||
} else {
|
||||
position = to;
|
||||
velocity = event.getAfter();
|
||||
position.setX(to.getX());
|
||||
position.setY(to.getY());
|
||||
position.setZ(to.getZ());
|
||||
position.setYaw(to.getYaw());
|
||||
position.setPitch(to.getPitch());
|
||||
velocity.copy(event.getAfter()); // event.getAfter() will never be null, as setAfter() will cause an NPE if null is passed in
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue