this bites me every single time

This commit is contained in:
Dylan K. Taylor 2024-11-24 21:45:45 +00:00
parent 45a4282e8b
commit dcbf1c706a
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 101 additions and 0 deletions

View 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);
}
}

View 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; }
}