Fix NPE on VehicleMoveEvent. Fixes #2195.

This commit is contained in:
Sauilitired 2018-12-26 19:25:20 +01:00
parent f1cf541606
commit d12bdcfda4
No known key found for this signature in database
GPG Key ID: C0207FF7EA146678

View File

@ -642,9 +642,8 @@ import java.util.regex.Pattern;
Vehicle vehicle = event.getVehicle(); Vehicle vehicle = event.getVehicle();
// Check allowed // Check allowed
if (!vehicle.getPassengers().isEmpty()) {
Entity passenger = vehicle.getPassengers().get(0);
Entity passenger = vehicle.getPassengers().get(1);
if (passenger instanceof Player) { if (passenger instanceof Player) {
final Player player = (Player) passenger; final Player player = (Player) passenger;
@ -709,6 +708,8 @@ import java.util.regex.Pattern;
} }
} }
} }
}
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)