summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobert Sargant <robert@sargant.com>2011-03-16 13:11:13 +0000
committerErik Broes <erikbroes@grum.nl>2011-04-02 17:10:36 +0200
commitc5fbd41659aaef95346fe31f9665b1a0c9222964 (patch)
tree93d00f602fac75018393fcae769f01ee81d0e4a0 /src
parent287114f8edc19da9eb28fba937551871611ddebf (diff)
downloadbukkit-c5fbd41659aaef95346fe31f9665b1a0c9222964.tar
bukkit-c5fbd41659aaef95346fe31f9665b1a0c9222964.tar.gz
bukkit-c5fbd41659aaef95346fe31f9665b1a0c9222964.tar.lz
bukkit-c5fbd41659aaef95346fe31f9665b1a0c9222964.tar.xz
bukkit-c5fbd41659aaef95346fe31f9665b1a0c9222964.zip
Added VEHICLE_DESTROY event
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/event/Event.java7
-rw-r--r--src/main/java/org/bukkit/event/vehicle/VehicleDestroyEvent.java33
-rw-r--r--src/main/java/org/bukkit/event/vehicle/VehicleListener.java8
-rw-r--r--src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java5
4 files changed, 53 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java
index dd59c069..01ad2acf 100644
--- a/src/main/java/org/bukkit/event/Event.java
+++ b/src/main/java/org/bukkit/event/Event.java
@@ -545,6 +545,13 @@ public abstract class Event implements Serializable {
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
*
* @see org.bukkit.event.vehicle.VehicleDamageEvent
diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleDestroyEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleDestroyEvent.java
new file mode 100644
index 00000000..195158ea
--- /dev/null
+++ b/src/main/java/org/bukkit/event/vehicle/VehicleDestroyEvent.java
@@ -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;
+ }
+
+}
diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleListener.java b/src/main/java/org/bukkit/event/vehicle/VehicleListener.java
index 32180107..bacde32f 100644
--- a/src/main/java/org/bukkit/event/vehicle/VehicleListener.java
+++ b/src/main/java/org/bukkit/event/vehicle/VehicleListener.java
@@ -70,6 +70,14 @@ public class VehicleListener implements Listener {
}
/**
+ * Called when a vehicle is destroyed.
+ *
+ * @param event
+ */
+ public void onVehicleDestroy(VehicleDestroyEvent event) {
+ }
+
+ /**
* Called when a vehicle goes through an update cycle
*
* @param event
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index ceb750ad..017076c7 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -455,6 +455,11 @@ public final class JavaPluginLoader implements PluginLoader {
((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:
return new EventExecutor() {
public void execute(Listener listener, Event event) {