[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.
It seems to be a new bug in 1.8.8 - the 1.8.7 versions work as they should.

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

Generated at Tue Apr 22 04:30:17 UTC 2025 using Jira 10.3.5#10030005-sha1:190c783f2bd6c69cd5accdb70f97e48812a78d14.