[SPIGOT-1124] Changed To-Location on Teleport event ignored Created: 11/Aug/15 Updated: 12/Jun/16 Resolved: 12/Jun/16 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Major |
Reporter: | minoneer | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | 1.8.8, bug, teleport |
Description |
On some PlayerTeleportEvent events, when changing the "to-location" via the setTo(Location) method, the player will not be teleportet to the new location but the one initially returned by the event. This happens for example when leaving a vehicle. I did some tracing and the problem appears to be in the PlayerConnection#a(double, double, double, float, float, Set<EnumPlayerTeleportFlags>) method, if the decompiled source is correct: // line 496 ff Location to = new Location(getPlayer().getWorld(), x, y, z, yaw, pitch); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), PlayerTeleportEvent.TeleportCause.UNKNOWN); this.server.getPluginManager().callEvent(event); // line 500 if ((event.isCancelled()) || (to.equals(event.getTo()))) { set.clear(); to = event.isCancelled() ? event.getFrom() : event.getTo(); d0 = to.getX(); d1 = to.getY(); d2 = to.getZ(); f = to.getYaw(); f1 = to.getPitch(); } internalTeleport(d0, d1, d2, f, f1, set); From my understanding, the second condition of the if statement in line 500 should be inverted, as the target location should be updated when the to location has changed, and not if it is still the same: // line 500 if ((event.isCancelled()) || (!to.equals(event.getTo()))) { Regards, minoneer |
Comments |
Comment by minoneer [ 30/May/16 ] |
Related Pull-Request https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/269/overview |