Broadcast player pick up event before picking up item
This commit is contained in:
parent
6babf426e3
commit
30955db9b3
@ -8,6 +8,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -86,6 +87,9 @@ public class ChairEffects {
|
||||
if (entity instanceof Item) {
|
||||
if (p.getInventory().firstEmpty() != -1) {
|
||||
Item item = (Item) entity;
|
||||
PlayerPickupItemEvent pickupevent = new PlayerPickupItemEvent(p, item, 0);
|
||||
Bukkit.getPluginManager().callEvent(pickupevent);
|
||||
if (!pickupevent.isCancelled()) {
|
||||
if (item.getPickupDelay() == 0) {
|
||||
p.getInventory().addItem(item.getItemStack());
|
||||
entity.remove();
|
||||
@ -96,6 +100,7 @@ public class ChairEffects {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},0,1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user