mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 18:29:46 +00:00
this bites me every single time
This commit is contained in:
parent
45a4282e8b
commit
dcbf1c706a
50
src/player/InventoryWindow.php
Normal file
50
src/player/InventoryWindow.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\player;
|
||||
|
||||
use pocketmine\inventory\Inventory;
|
||||
|
||||
abstract class InventoryWindow{
|
||||
|
||||
public function __construct(
|
||||
protected Player $viewer,
|
||||
protected Inventory $inventory
|
||||
){}
|
||||
|
||||
public function getViewer() : Player{
|
||||
return $this->viewer;
|
||||
}
|
||||
|
||||
public function getInventory() : Inventory{
|
||||
return $this->inventory;
|
||||
}
|
||||
|
||||
public function onOpen() : void{
|
||||
$this->inventory->onOpen($this->viewer);
|
||||
}
|
||||
|
||||
public function onClose() : void{
|
||||
$this->inventory->onClose($this->viewer);
|
||||
}
|
||||
}
|
51
src/player/PlayerInventoryWindow.php
Normal file
51
src/player/PlayerInventoryWindow.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\player;
|
||||
|
||||
use pocketmine\inventory\Inventory;
|
||||
|
||||
/**
|
||||
* Window for player-owned inventories. The player can access these at all times.
|
||||
*/
|
||||
final class PlayerInventoryWindow extends InventoryWindow{
|
||||
|
||||
public const TYPE_INVENTORY = 0;
|
||||
public const TYPE_OFFHAND = 1;
|
||||
public const TYPE_ARMOR = 2;
|
||||
public const TYPE_CURSOR = 3;
|
||||
public const TYPE_CRAFTING = 4;
|
||||
|
||||
public function __construct(
|
||||
Player $viewer,
|
||||
Inventory $inventory,
|
||||
private int $type
|
||||
){
|
||||
parent::__construct($viewer, $inventory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of player inventory in this window.
|
||||
*/
|
||||
public function getType() : int{ return $this->type; }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user