mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 22:44:17 +01:00
Added ItemDespawnEvent
This commit is contained in:
parent
cc05bea457
commit
6cc56b8c2c
@ -1,6 +1,9 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit
|
// CraftBukkit start
|
||||||
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
|
// CraftBukkit End
|
||||||
|
|
||||||
public class EntityItem extends Entity {
|
public class EntityItem extends Entity {
|
||||||
|
|
||||||
@ -83,6 +86,12 @@ public class EntityItem extends Entity {
|
|||||||
++this.e;
|
++this.e;
|
||||||
++this.b;
|
++this.b;
|
||||||
if (this.b >= 6000) {
|
if (this.b >= 6000) {
|
||||||
|
// CraftBukkit start
|
||||||
|
if(CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
||||||
|
this.b = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
this.die();
|
this.die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,6 @@ public class CraftEventFactory {
|
|||||||
/**
|
/**
|
||||||
* Player Interact event
|
* Player Interact event
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, ItemStack itemstack) {
|
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, ItemStack itemstack) {
|
||||||
if (action != Action.LEFT_CLICK_AIR && action != Action.RIGHT_CLICK_AIR) {
|
if (action != Action.LEFT_CLICK_AIR && action != Action.RIGHT_CLICK_AIR) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
@ -286,6 +285,18 @@ public class CraftEventFactory {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ItemDespawnEvent
|
||||||
|
*/
|
||||||
|
public static ItemDespawnEvent callItemDespawnEvent(EntityItem entityitem) {
|
||||||
|
org.bukkit.entity.Entity entity = entityitem.getBukkitEntity();
|
||||||
|
|
||||||
|
ItemDespawnEvent event = new ItemDespawnEvent(entity, entity.getLocation());
|
||||||
|
|
||||||
|
((CraftServer) entity.getServer()).getPluginManager().callEvent(event);
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BlockFadeEvent
|
* BlockFadeEvent
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user