Hello, ive been messing around with a few things but i just cant seem to get this to work, PHP: $chestPlate = Item::get(299); $sender->getInventory()->setChestplate($chestPlate); But i keep getting this error 05.04 22:07:57 [Server] Server thread/DEBUG #1 src/pocketmine/command/SimpleCommandMap(258): pocketmine\command\PluginCommand->execute(pocketmine\Player object, string upgrade, array Array()) 05.04 22:07:57 [Server] Server thread/DEBUG #0 src/pocketmine/command/PluginCommand(58): Evan\Upgrades\Main->onCommand(pocketmine\Player object, pocketmine\command\PluginCommand object, string upgrade, array Array()) 05.04 22:07:57 [Server] Server thread/CRITICAL Error: "Call to undefined method pocketmine\inventory\PlayerInventory::setChestplate()" (EXCEPTION) in "Upgrades/src/Evan/Upgrades/Main" at line 24 05.04 22:07:57 [Server] Server thread/CRITICAL Unhandled exception executing command 'upgrade' in upgrade: Call to undefined method pocketmine\inventory\PlayerInventory::setChestplate() Any suggestions anyone? Ive found old threads on how to do this but their answers wont work either
You have to use getArmorInventory(): PHP: $chestPlate = Item::get(299);$sender->getArmorInventory()->setChestplate($chestPlate);