Cleaning up PlayerDropItemEvent

This commit is contained in:
James Logsdon 2011-02-11 16:49:47 -05:00 committed by Erik Broes
parent 49ced27311
commit 6c86db411c

View File

@ -1,9 +1,9 @@
package org.bukkit.event.player; package org.bukkit.event.player;
import org.bukkit.entity.ItemDrop; import org.bukkit.entity.ItemDrop;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
/** /**
* Thrown when a player drops an item from their inventory * Thrown when a player drops an item from their inventory
@ -12,8 +12,8 @@ public class PlayerDropItemEvent extends PlayerEvent implements Cancellable {
private final ItemDrop drop; private final ItemDrop drop;
private boolean cancel = false; private boolean cancel = false;
public PlayerDropItemEvent(final Type type, final Player player, final ItemDrop drop) { public PlayerDropItemEvent(final Player player, final ItemDrop drop) {
super(type, player); super(Event.Type.PLAYER_DROP_ITEM, player);
this.drop = drop; this.drop = drop;
} }
@ -30,6 +30,10 @@ public class PlayerDropItemEvent extends PlayerEvent implements Cancellable {
* Gets the cancellation state of this event. A cancelled event will not * Gets the cancellation state of this event. A cancelled event will not
* be executed in the server, but will still pass to other plugins * be executed in the server, but will still pass to other plugins
* *
* If an item drop event is cancelled, the item will not be dropped and it
* will be added back to the players inventory.
* This will not fire an event.
*
* @return true if this event is cancelled * @return true if this event is cancelled
*/ */
public boolean isCancelled() { public boolean isCancelled() {
@ -40,6 +44,10 @@ public class PlayerDropItemEvent extends PlayerEvent implements Cancellable {
* Sets the cancellation state of this event. A cancelled event will not * Sets the cancellation state of this event. A cancelled event will not
* be executed in the server, but will still pass to other plugins * be executed in the server, but will still pass to other plugins
* *
* If an item drop event is cancelled, the item will not be dropped and it
* will be added back to the players inventory.
* This will not fire an event.
*
* @param cancel true if you wish to cancel this event * @param cancel true if you wish to cancel this event
*/ */
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {