use of org.bukkit.entity.Vehicle in project BKCommonLib by bergerhealer.
the class CommonListener method onPlayerInteractEntity.
/*
* This is a temporary workaround until the VehicleExitEvent works again
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
protected void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
if (event.getPlayer().getVehicle() == event.getRightClicked() && event.getRightClicked() instanceof Vehicle) {
// Call a player exit event
final Vehicle vehicle = (Vehicle) event.getRightClicked();
event.setCancelled(CommonUtil.callEvent(new VehicleExitEvent(vehicle, event.getPlayer())).isCancelled());
}
}
Aggregations