-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; } | ||
} |