Eject passengers and unmount before teleporting. Wont work otherwise.

This commit is contained in:
Olof Larsson 2013-05-29 14:44:12 +02:00
parent 6d57d6f51c
commit cc75cb8e15

View File

@ -1,6 +1,7 @@
package com.massivecraft.mcore.mixin;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@ -40,6 +41,12 @@ public class TeleportMixinDefault extends TeleportMixinAbstract
throw new TeleporterException(Txt.parse("<b>Could not calculate the location: %s", e.getMessage()));
}
// eject passengers and unmount before transport
player.eject();
Entity vehicle = player.getVehicle();
if (vehicle != null) vehicle.eject();
// Do the teleport
TeleportMixinCauseEngine.get().setMixinCausedTeleportIncoming(true);
player.teleport(location);
TeleportMixinCauseEngine.get().setMixinCausedTeleportIncoming(false);