Skip to content

phuongaz-pm-pl/ItemHolder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ItemHolder

Simple item storage plugin for PocketMine.

Usage:

    public function test() : void {
        IHolderAPI::register("testcase1", [VanillaItems::DIAMOND(), VanillaItems::DIAMOND_PICKAXE()], function(bool $isRegister) {
            $this->testupdate();
        });
    }

    public function testupdate() : void {
        IHolderAPI::update("testcase1", [VanillaItems::GOLD_INGOT(), VanillaItems::GOLD_INGOT()], function(string|null $itemDataRaw) {
            var_dump($itemDataRaw);
            $this->testGet();
        });
    }

    public function testGet() : void {
        IHolderAPI::get("testcase1", function (array|Item|null $itemData){
            $itemData = (is_array($itemData)) ? $itemData : [$itemData];
            foreach ($itemData as $item) {
                var_dump($item->getName());
            }
        });
    }

Simple BackPack:

$playerName = Player->getName();
$items = Inventory->getContents();

// register 
IHolderAPI::register($playerName, $items);

// get
IHolderAPI::get($playerName, function($itemData) {
    if(is_array($item)) {
        Inventory->setContents($item)
    }
});

About

Simple item storage plugin for PocketMine.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages