Extend HumanEntity#dropItem API (#11810)
This commit is contained in:
@@ -1342,17 +1342,18 @@
|
||||
}
|
||||
|
||||
public SectionPos getLastSectionPos() {
|
||||
@@ -1930,21 +_,54 @@
|
||||
@@ -1930,21 +_,55 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- public ItemEntity drop(ItemStack droppedItem, boolean dropAround, boolean traceItem) {
|
||||
+ public ItemEntity drop(ItemStack droppedItem, boolean dropAround, boolean traceItem, boolean callEvent) { // CraftBukkit - SPIGOT-2942: Add boolean to call event
|
||||
+ public ItemEntity drop(ItemStack droppedItem, boolean dropAround, boolean traceItem, boolean callEvent, @Nullable java.util.function.Consumer<org.bukkit.entity.Item> entityOperation) { // Paper start - Extend HumanEntity#dropItem API
|
||||
ItemEntity itemEntity = this.createItemStackToDrop(droppedItem, dropAround, traceItem);
|
||||
if (itemEntity == null) {
|
||||
return null;
|
||||
} else {
|
||||
+ // CraftBukkit start - fire PlayerDropItemEvent
|
||||
+ if (entityOperation != null) entityOperation.accept((org.bukkit.entity.Item) itemEntity.getBukkitEntity());
|
||||
+ if (callEvent) {
|
||||
+ org.bukkit.entity.Player player = this.getBukkitEntity();
|
||||
+ org.bukkit.entity.Item drop = (org.bukkit.entity.Item) itemEntity.getBukkitEntity();
|
||||
|
||||
Reference in New Issue
Block a user