cn.nukkit.event.inventory.InventoryPickupArrowEvent Java Examples
The following examples show how to use
cn.nukkit.event.inventory.InventoryPickupArrowEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityArrow.java From Jupiter with GNU General Public License v3.0 | 5 votes |
@Override public void onCollideWithPlayer(Player player) { if(!this.hadCollision) { return; } Item item = new Item(Item.ARROW, 0, 1); PlayerInventory playerInventory = player.getInventory(); if(player.isSurvival() && playerInventory.canAddItem(item)) { return; } InventoryPickupArrowEvent ev; this.server.getPluginManager().callEvent(ev = new InventoryPickupArrowEvent(playerInventory, this)); if(ev.isCancelled()) { return; } TakeItemEntityPacket pk = new TakeItemEntityPacket(); pk.entityRuntimeId = player.getId(); pk.target = this.getId(); Server.broadcastPacket(this.getViewers().values(), pk); playerInventory.addItem(item); this.kill(); }