Makes sure to check player passengers from the root entity
Some checks failed
EpicKnarvik97/Stargate/pipeline/head There was a failure building this commit
Some checks failed
EpicKnarvik97/Stargate/pipeline/head There was a failure building this commit
This commit is contained in:
parent
248caee620
commit
56d59f0d2a
@ -64,7 +64,7 @@ public class VehicleEventListener implements Listener {
|
|||||||
|
|
||||||
if (!passengers.isEmpty() && TeleportHelper.containsPlayer(passengers)) {
|
if (!passengers.isEmpty() && TeleportHelper.containsPlayer(passengers)) {
|
||||||
Stargate.debug(route, "Found passenger vehicle");
|
Stargate.debug(route, "Found passenger vehicle");
|
||||||
teleportPlayerAndVehicle(entrancePortal, vehicle, passengers);
|
teleportPlayerAndVehicle(entrancePortal, vehicle);
|
||||||
} else {
|
} else {
|
||||||
Stargate.debug(route, "Found vehicle without players");
|
Stargate.debug(route, "Found vehicle without players");
|
||||||
Portal destinationPortal = entrancePortal.getPortalActivator().getDestination();
|
Portal destinationPortal = entrancePortal.getPortalActivator().getDestination();
|
||||||
@ -83,10 +83,13 @@ public class VehicleEventListener implements Listener {
|
|||||||
*
|
*
|
||||||
* @param entrancePortal <p>The portal the minecart entered</p>
|
* @param entrancePortal <p>The portal the minecart entered</p>
|
||||||
* @param vehicle <p>The vehicle to teleport</p>
|
* @param vehicle <p>The vehicle to teleport</p>
|
||||||
* @param passengers <p>Any entities sitting in the minecart</p>
|
|
||||||
*/
|
*/
|
||||||
private static void teleportPlayerAndVehicle(Portal entrancePortal, Vehicle vehicle, List<Entity> passengers) {
|
private static void teleportPlayerAndVehicle(Portal entrancePortal, Vehicle vehicle) {
|
||||||
List<Player> players = TeleportHelper.getPlayers(passengers);
|
Entity rootEntity = vehicle;
|
||||||
|
while (rootEntity.getVehicle() != null) {
|
||||||
|
rootEntity = rootEntity.getVehicle();
|
||||||
|
}
|
||||||
|
List<Player> players = TeleportHelper.getPlayers(rootEntity.getPassengers());
|
||||||
Portal destinationPortal = null;
|
Portal destinationPortal = null;
|
||||||
|
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user