[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,7 +1,10 @@
package org.bukkit.event.painting;
import java.util.List;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Painting;
import org.bukkit.inventory.ItemStack;
/**
* Triggered when a painting is removed by an entity
@@ -9,8 +12,8 @@ import org.bukkit.entity.Painting;
public class PaintingBreakByEntityEvent extends PaintingBreakEvent {
private final Entity remover;
public PaintingBreakByEntityEvent(final Painting painting, final Entity remover) {
super(painting, RemoveCause.ENTITY);
public PaintingBreakByEntityEvent(final Painting painting, final Entity remover, List<ItemStack> drops) {
super(painting, RemoveCause.ENTITY, drops);
this.remover = remover;
}

View File

@@ -1,8 +1,11 @@
package org.bukkit.event.painting;
import java.util.List;
import org.bukkit.entity.Painting;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
/**
* Triggered when a painting is removed
@@ -11,10 +14,12 @@ public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private final RemoveCause cause;
private List<ItemStack> drops;
public PaintingBreakEvent(final Painting painting, final RemoveCause cause) {
public PaintingBreakEvent(final Painting painting, final RemoveCause cause, List<ItemStack> drops) {
super(painting);
this.cause = cause;
this.drops = drops;
}
/**
@@ -34,6 +39,14 @@ public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
this.cancelled = cancel;
}
/**
* Gets the list of items to be dropped. Modifying this list will modify what's actually dropped.
* @return A list of drops
*/
public List<ItemStack> getDrops() {
return drops;
}
/**
* An enum to specify the cause of the removal
*/