[Bleeding] Added getting and setting drops to all appropriate events. Fixes BUKKIT-397 and fixes BUKKIT-1252

By: Celtic Minstrel <celtic.minstrel.ca@some.place>
This commit is contained in:
Bukkit/Spigot
2011-08-14 22:34:13 -04:00
parent da44559df3
commit bbe996077c
6 changed files with 68 additions and 7 deletions

View File

@@ -1,9 +1,12 @@
package org.bukkit.event.vehicle;
import java.util.List;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
/**
* Raised when a vehicle is destroyed, which could be caused by either a player
@@ -14,10 +17,12 @@ public class VehicleDestroyEvent extends VehicleEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Entity attacker;
private boolean cancelled;
private List<ItemStack> drops;
public VehicleDestroyEvent(final Vehicle vehicle, final Entity attacker) {
public VehicleDestroyEvent(final Vehicle vehicle, final Entity attacker, List<ItemStack> drops) {
super(vehicle);
this.attacker = attacker;
this.drops = drops;
}
/**
@@ -45,4 +50,14 @@ public class VehicleDestroyEvent extends VehicleEvent implements Cancellable {
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Gets a list of drops that this vehicle should drop when broken. Changes to this list will
* affect what is actually dropped. This list does not include the contents of the inventory
* if this is a storage minecart; if that's needed, it can be fetched by casting.
* @return A list of drops
*/
public List<ItemStack> getDrops() {
return drops;
}
}