alvin0319 / CustomItemLoader

This is a plugin that brings the custom item to your server for PocketMine-MP!
https://discord.com/invite/Py2vSwg3B3
GNU Lesser General Public License v3.0
98 stars 28 forks source link

[BUG:] item registering doesn't work #39

Closed supercrafter333 closed 3 years ago

supercrafter333 commented 3 years ago

My Code:

if (class_exists(CustomItemLoader::class)) {
            $copperItem = new CustomItem("Block of Copper",
            [
                "id" => 255 - $copperblock->getId(),
                "meta" => 0,
                "namespace" => "minecraft:copper_block",
                "name" => $copperblock->getName(),
                "texture" => "block_of_cooper.png"
            ]);
            CustomItemManager::registerItem($copperItem);
            CustomItemManager::init();
        }

Error:

[18:54:48] [Server thread/CRITICAL]: Error: "Call to a member function setValue() on null" (EXCEPTION) in "plugins/CustomItemLoader/src/alvin0319/CustomItemLoader/CustomItemManager" at line 109
[18:54:48] [Server thread/CRITICAL]: #0 plugins/CustomItemLoader/src/alvin0319/CustomItemLoader/CustomItemManager(105): alvin0319\CustomItemLoader\CustomItemManager::refresh()
[18:54:48] [Server thread/CRITICAL]: #1 plugins/MissingBlockX/src/supercrafter333/MissingBlockX/MissingBlockX(417): alvin0319\CustomItemLoader\CustomItemManager::registerItem(object alvin0319\CustomItemLoader\item\CustomItem)
[18:54:48] [Server thread/CRITICAL]: #2 pmsrc/src/pocketmine/plugin/PluginBase(116): supercrafter333\MissingBlockX\MissingBlockX->onEnable()
[18:54:48] [Server thread/CRITICAL]: #3 pmsrc/src/pocketmine/plugin/PluginManager(552): pocketmine\plugin\PluginBase->setEnabled(boolean 1)
[18:54:48] [Server thread/CRITICAL]: #4 pmsrc/src/pocketmine/Server(1785): pocketmine\plugin\PluginManager->enablePlugin(object supercrafter333\MissingBlockX\MissingBlockX)
[18:54:48] [Server thread/CRITICAL]: #5 pmsrc/src/pocketmine/Server(1771): pocketmine\Server->enablePlugin(object supercrafter333\MissingBlockX\MissingBlockX)
[18:54:48] [Server thread/CRITICAL]: #6 pmsrc/src/pocketmine/Server(1584): pocketmine\Server->enablePlugins(integer 1)
[18:54:48] [Server thread/CRITICAL]: #7 pmsrc/src/pocketmine/PocketMine(291): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[11] /home/DevX/, string[19] /home/DevX/plugins/)
[18:54:48] [Server thread/CRITICAL]: #8 pmsrc/src/pocketmine/PocketMine(321): pocketmine\server()
[18:54:48] [Server thread/CRITICAL]: #9 pmsrc(11): require(string[63] phar:///home/DevX/pocketmine.phar/src/pocketmine/PocketMine.php)
alvin0319 commented 3 years ago

Try init CustomItemManager before registering item.

alvin0319 commented 3 years ago

Closing due to no response