Hi, I have a plugin that prevents boat from destroying but it prevents only from crashes but when for example boat falls from a waterfall the boat is destroyed by the fall. I have this code: Code:java @EventHandler(priority = EventPriority.HIGHEST)public void onVehicleDestroy(VehicleDestroyEvent event) {if ((event.getVehicle() instanceof Boat)) {event.setCancelled(true);Bukkit.broadcastMessage("VehicleDestroyEvent");}} It cancels perfectly when boat crash or something but when it falls or the boat gets out of water is destroyed and the event is not fired , also when a boat falls at another boat under waterfall the boat gets destroyed... So I dont know how to totally prevent boat from breaking.
Yes it is. My boat does not get destroyed by crash but when the boat falls it still gets destroyed and the event VehicleDestroyEvent is not fired, it is a bug or there is another vehicle destroy event of something like that ?
I have already tried it: Code:java @EventHandler(priority = EventPriority.HIGHEST)public void onVehicleEntityDestroy(EntityDeathEvent event) {if ((event.getEntity() instanceof Boat)) {Player pasazer = (Player)event.getEntity().getVehicle().getPassenger();if (pasazer != null) {Bukkit.broadcastMessage("EntityDamageEvent");}}} And also: Code:java @EventHandlerpublic void onVehicleDamage(VehicleDamageEvent event) {if ((event.getVehicle() instanceof Boat)) {Player pasazer = (Player)event.getVehicle().getPassenger();if (pasazer != null) {event.setCancelled(true);Bukkit.broadcastMessage("VehicleDamageEvent");}}} These events are not even fired when I am crashing to some walls or obstacles.
Code:java @EventHandlerpublic void onVehicleDestroy(VehicleDestroyEvent e) {if (e.getVehicle() instanceof Boat) {e.setCancelled(true);return;}} @EventHandlerpublic void onVehicleDamageEvent(VehicleDamageEvent e) {if (e.getVehicle() instanceof Boat) {if (e.getVehicle().getPassenger() == null) {e.getVehicle().remove();return;}e.setCancelled(true);return;}}
What ? This I exactly posted in my reply above lol. Can someone list me please on which events can boat be destroyed ? Because in case of boat fall VehicleDestroyEvent is not fired so I dont know where to cancel destruction of the boat. Should this be marked as error in Bukkit ? EDIT by Moderator: merged posts, please use the edit button instead of double posting.