mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 09:17:36 +01:00
Added ItemDespawnEvent
By: Feildmaster <admin@feildmaster.com>
This commit is contained in:
parent
544b0a05ae
commit
40f4710726
@ -600,6 +600,12 @@ public abstract class Event implements Serializable {
|
||||
* @see org.bukkit.event.world.TreeGrowEvent
|
||||
*/
|
||||
STRUCTURE_GROW(Category.WORLD),
|
||||
/**
|
||||
* Called when an item despawns from a world
|
||||
*
|
||||
* @see org.bukkit.event.entity.ItemDespawnEvent
|
||||
*/
|
||||
ITEM_DESPAWN (Category.WORLD),
|
||||
|
||||
/**
|
||||
* ENTITY EVENTS
|
||||
|
@ -162,4 +162,11 @@ public class EntityListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onSlimeSplit(SlimeSplitEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when an item despawns from a world
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onItemDespawn(ItemDespawnEvent event) {}
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class ItemDespawnEvent extends EntityEvent implements Cancellable {
|
||||
private boolean canceled;
|
||||
private Location location;
|
||||
|
||||
public ItemDespawnEvent(Entity spawnee, Location loc) {
|
||||
super(Type.ITEM_DESPAWN, spawnee);
|
||||
location = loc;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return canceled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
canceled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location at which the item is despawning.
|
||||
*
|
||||
* @return The location at which the item is despawning
|
||||
*/
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
}
|
@ -840,6 +840,13 @@ public class JavaPluginLoader implements PluginLoader {
|
||||
}
|
||||
};
|
||||
|
||||
case ITEM_DESPAWN:
|
||||
return new EventExecutor() {
|
||||
public void execute(Listener listener, Event event) {
|
||||
((EntityListener) listener).onItemDespawn((ItemDespawnEvent) event);
|
||||
}
|
||||
};
|
||||
|
||||
// Vehicle Events
|
||||
case VEHICLE_CREATE:
|
||||
return new EventExecutor() {
|
||||
|
Loading…
Reference in New Issue
Block a user