Makes sure teleportation not from a plugin does not trigger vehicle teleportation
This commit is contained in:
parent
4acea17ba3
commit
2b52759e00
@ -80,19 +80,18 @@ public class PlayerEventsListener implements Listener {
|
|||||||
&& PortalHandler.getByAdjacentEntrance(event.getFrom()) != null) {
|
&& PortalHandler.getByAdjacentEntrance(event.getFrom()) != null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled() || cause != PlayerTeleportEvent.TeleportCause.PLUGIN) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity playerVehicle = event.getPlayer().getVehicle();
|
Entity playerVehicle = event.getPlayer().getVehicle();
|
||||||
Portal portal = PortalHandler.getByEntrance(event.getFrom());
|
Portal portal = PortalHandler.getByAdjacentEntrance(event.getFrom());
|
||||||
if (playerVehicle != null && PortalHandler.getByEntrance(event.getFrom()) != null &&
|
if (playerVehicle != null && portal != null &&
|
||||||
!(playerVehicle instanceof Minecart) &&
|
!(playerVehicle instanceof Minecart) &&
|
||||||
!(playerVehicle instanceof Boat)) {
|
!(playerVehicle instanceof Boat)) {
|
||||||
Portal destinationPortal = portal.getDestination();
|
Portal destinationPortal = portal.getDestination();
|
||||||
if (destinationPortal != null) {
|
if (destinationPortal != null) {
|
||||||
VehicleEventListener.teleportVehicleAfterPlayer((Vehicle) playerVehicle, destinationPortal, event.getPlayer());
|
VehicleEventListener.teleportVehicleAfterPlayer((Vehicle) playerVehicle, destinationPortal, event.getPlayer());
|
||||||
Stargate.debug("playerTeleport", "Player was driving " + playerVehicle.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user