[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.player;
import java.util.List;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
/**
* Called when a player shears an entity
@@ -12,11 +15,13 @@ public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel;
private final Entity what;
private final List<ItemStack> items;
public PlayerShearEntityEvent(final Player who, final Entity what) {
public PlayerShearEntityEvent(final Player who, final Entity what, final List<ItemStack> drops) {
super(who);
this.cancel = false;
this.what = what;
this.items = drops;
}
public boolean isCancelled() {
@@ -36,6 +41,15 @@ public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable {
return what;
}
/**
* Get the items that will drop as a result of the shearing. To change the
* items dropped, change the contents of this list.
* @return The list of items.
*/
public List<ItemStack> getDrops() {
return items;
}
@Override
public HandlerList getHandlers() {
return handlers;