mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 18:59:00 +00:00
Added Player to CraftItemEvent
This commit is contained in:
parent
86c1198648
commit
6273875a22
@ -1863,7 +1863,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen($packet->skin) !== 64 * 32 * 4 and strlen($packet->skin) !== 64 * 64 * 4){
|
if(strlen($packet->skin) !== 64 * 32 * 4 and strlen($packet->skin) !== 64 * 64 * 4){
|
||||||
$this->close("", "disconnectionScreen.invalidSkin");
|
$this->close("", "disconnectionScreen.invalidSkin");
|
||||||
break;
|
break;
|
||||||
@ -2719,7 +2719,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->server->getPluginManager()->callEvent($ev = new CraftItemEvent($ingredients, $recipe));
|
$this->server->getPluginManager()->callEvent($ev = new CraftItemEvent($this, $ingredients, $recipe));
|
||||||
|
|
||||||
if($ev->isCancelled()){
|
if($ev->isCancelled()){
|
||||||
$this->inventory->sendContents($this);
|
$this->inventory->sendContents($this);
|
||||||
@ -2985,7 +2985,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
}
|
}
|
||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendPopup($message, $subtitle = ""){
|
public function sendPopup($message, $subtitle = ""){
|
||||||
$pk = new TextPacket();
|
$pk = new TextPacket();
|
||||||
$pk->type = TextPacket::TYPE_POPUP;
|
$pk->type = TextPacket::TYPE_POPUP;
|
||||||
@ -3017,7 +3017,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
$pk->message = $reason;
|
$pk->message = $reason;
|
||||||
$this->directDataPacket($pk);
|
$this->directDataPacket($pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->connected = false;
|
$this->connected = false;
|
||||||
if(strlen($this->getName()) > 0){
|
if(strlen($this->getName()) > 0){
|
||||||
$this->server->getPluginManager()->callEvent($ev = new PlayerQuitEvent($this, $message, true));
|
$this->server->getPluginManager()->callEvent($ev = new PlayerQuitEvent($this, $message, true));
|
||||||
|
@ -25,6 +25,7 @@ use pocketmine\event\Cancellable;
|
|||||||
use pocketmine\event\Event;
|
use pocketmine\event\Event;
|
||||||
use pocketmine\inventory\Recipe;
|
use pocketmine\inventory\Recipe;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
|
use pocketmine\Player;
|
||||||
|
|
||||||
class CraftItemEvent extends Event implements Cancellable{
|
class CraftItemEvent extends Event implements Cancellable{
|
||||||
public static $handlerList = null;
|
public static $handlerList = null;
|
||||||
@ -33,12 +34,17 @@ class CraftItemEvent extends Event implements Cancellable{
|
|||||||
private $input = [];
|
private $input = [];
|
||||||
/** @var Recipe */
|
/** @var Recipe */
|
||||||
private $recipe;
|
private $recipe;
|
||||||
|
/** @var \pocketmine\Player */
|
||||||
|
private $player;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param \pocketmine\Player $player
|
||||||
* @param Item[] $input
|
* @param Item[] $input
|
||||||
* @param Recipe $recipe
|
* @param Recipe $recipe
|
||||||
*/
|
*/
|
||||||
public function __construct(array $input, Recipe $recipe){
|
public function __construct(Player $player, array $input, Recipe $recipe){
|
||||||
|
$this->player = $player;
|
||||||
$this->input = $input;
|
$this->input = $input;
|
||||||
$this->recipe = $recipe;
|
$this->recipe = $recipe;
|
||||||
}
|
}
|
||||||
@ -62,4 +68,10 @@ class CraftItemEvent extends Event implements Cancellable{
|
|||||||
return $this->recipe;
|
return $this->recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* @return \pocktemine\Player
|
||||||
|
*/
|
||||||
|
public function getPlayer(){
|
||||||
|
return $this->player;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user