Skip to content

Update for PocketMine version 5.0.0 in quick mode

Notifications You must be signed in to change notification settings

eR0oT/InventoryAPI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InventoryAPI | 4.0.0

Simple API to create GUI for your server ! 🎊

Uses: use refaltor\inventoryapi\inventories\{SimpleChestInventory, DoubleInventory};

Create Simple Inventory:

$simpleInventory = InventoryAPI::createSimpleChest(isViewOnly: false);
        $simpleInventory->setName('SimpleInventory');
        $simpleInventory->setContents([
            VanillaItems::GOLD_INGOT(),
            VanillaItems::STEAK()
        ]);
        $simpleInventory->setClickListener(function (Player $player, BaseInventoryCustom $inventory, Item $sourceItem, Item $targetItem, int $slot): void {
            if ($slot === 0) {
                $inventory->transactionCancel();
            } else {
                $inventory->addItem(VanillaItems::COAL()->setCustomName("Example"));
            }
        });
        $simpleInventory->setCloseListener(function (Player $player, BaseInventoryCustom $inventory): void {
            Server::getInstance()->broadcastMessage("Hello close chest !");
        });
        $simpleInventory->send($player);

Create Double Chest Inventory:

 $doubleChestInventory = InventoryAPI::createDoubleChest(isViewOnly: false);
        $doubleChestInventory->setName('DoubleChestInventory');
        $doubleChestInventory->setContents([
            VanillaItems::GOLD_INGOT(),
            VanillaItems::STEAK()
        ]);
        $doubleChestInventory->setClickListener(function (Player $player, BaseInventoryCustom $inventory, Item $sourceItem, Item $targetItem, int $slot): void {
            if ($slot === 0) {
                $inventory->transactionCancel();
            } else {
                $inventory->addItem(VanillaItems::COAL()->setCustomName("Example"));
            }
        });
        $doubleChestInventory->setCloseListener(function (Player $player, BaseInventoryCustom $inventory): void {
            Server::getInstance()->broadcastMessage("Hello close chest !");
        });
        $doubleChestInventory->send($player);

About

Update for PocketMine version 5.0.0 in quick mode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%