mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 01:37:35 +01:00
Added VEHICLE_DESTROY event
By: Robert Sargant <robert@sargant.com>
This commit is contained in:
parent
531a69463a
commit
22b860367d
@ -544,6 +544,13 @@ public abstract class Event implements Serializable {
|
|||||||
*/
|
*/
|
||||||
VEHICLE_CREATE (Category.VEHICLE),
|
VEHICLE_CREATE (Category.VEHICLE),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a vehicle is destroyed
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.vehicle.VehicleDestroyEvent
|
||||||
|
*/
|
||||||
|
VEHICLE_DESTROY (Category.VEHICLE),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle is damaged by a LivingEntity
|
* Called when a vehicle is damaged by a LivingEntity
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package org.bukkit.event.vehicle;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Vehicle;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raised when a vehicle is destroyed
|
||||||
|
*
|
||||||
|
* @author sk89q, cyklo
|
||||||
|
*/
|
||||||
|
public class VehicleDestroyEvent extends VehicleEvent implements Cancellable {
|
||||||
|
private Entity attacker;
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
public VehicleDestroyEvent(Vehicle vehicle, Entity attacker) {
|
||||||
|
super(Type.VEHICLE_DESTROY, vehicle);
|
||||||
|
this.attacker = attacker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Entity getAttacker() {
|
||||||
|
return attacker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancelled = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -69,6 +69,14 @@ public class VehicleListener implements Listener {
|
|||||||
public void onVehicleMove(VehicleMoveEvent event) {
|
public void onVehicleMove(VehicleMoveEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a vehicle is destroyed.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
public void onVehicleDestroy(VehicleDestroyEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle goes through an update cycle
|
* Called when a vehicle goes through an update cycle
|
||||||
*
|
*
|
||||||
|
@ -455,6 +455,11 @@ public final class JavaPluginLoader implements PluginLoader {
|
|||||||
((VehicleListener) listener).onVehicleDamage((VehicleDamageEvent) event);
|
((VehicleListener) listener).onVehicleDamage((VehicleDamageEvent) event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
case VEHICLE_DESTROY:
|
||||||
|
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
||||||
|
((VehicleListener)listener).onVehicleDestroy( (VehicleDestroyEvent)event );
|
||||||
|
}
|
||||||
|
};
|
||||||
case VEHICLE_COLLISION_BLOCK:
|
case VEHICLE_COLLISION_BLOCK:
|
||||||
return new EventExecutor() {
|
return new EventExecutor() {
|
||||||
public void execute(Listener listener, Event event) {
|
public void execute(Listener listener, Event event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user