mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-05 11:27:07 +00:00
Added InventoryPickupArrowEvent
This commit is contained in:
parent
00b282d40c
commit
022a978ffb
@ -36,6 +36,7 @@ use pocketmine\event\entity\EntityRegainHealthEvent;
|
||||
use pocketmine\event\entity\EntityShootBowEvent;
|
||||
use pocketmine\event\entity\ProjectileLaunchEvent;
|
||||
use pocketmine\event\inventory\InventoryCloseEvent;
|
||||
use pocketmine\event\inventory\InventoryPickupArrowEvent;
|
||||
use pocketmine\event\inventory\InventoryPickupItemEvent;
|
||||
use pocketmine\event\player\PlayerAchievementAwardedEvent;
|
||||
use pocketmine\event\player\PlayerAnimationEvent;
|
||||
@ -1202,7 +1203,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->server->getPluginManager()->callEvent($ev = InventoryPickupItemEvent::createEvent($this->inventory, $entity));
|
||||
$this->server->getPluginManager()->callEvent($ev = InventoryPickupArrowEvent::createEvent($this->inventory, $entity));
|
||||
if($ev->isCancelled()){
|
||||
continue;
|
||||
}
|
||||
|
52
src/pocketmine/event/inventory/InventoryPickupArrowEvent.php
Normal file
52
src/pocketmine/event/inventory/InventoryPickupArrowEvent.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\event\inventory;
|
||||
|
||||
use pocketmine\entity\Arrow;
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\inventory\Inventory;
|
||||
|
||||
class InventoryPickupArrowEvent extends InventoryEvent implements Cancellable{
|
||||
public static $handlerList = null;
|
||||
public static $eventPool = [];
|
||||
public static $nextEvent = 0;
|
||||
|
||||
/** @var Arrow */
|
||||
private $arrow;
|
||||
|
||||
/**
|
||||
* @param Inventory $inventory
|
||||
* @param Arrow $arrow
|
||||
*/
|
||||
public function __construct(Inventory $inventory, Arrow $arrow){
|
||||
$this->arrow = $arrow;
|
||||
parent::__construct($inventory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Arrow
|
||||
*/
|
||||
public function getArrow(){
|
||||
return $this->arrow;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user