I'm using a code that was working fine but now its causing an error. The Error: PHP: Error: "Call to undefined method pocketmine\inventory\PlayerInventory::setHelmet()" (EXCEPTION) in "Test2/src/test2/Main" at line 1022018-03-18 [06:22:04] [Server thread/DEBUG]: #0 src/pocketmine/plugin/MethodEventExecutor(38): test2\Main->onInteract(pocketmine\event\player\PlayerInteractEvent object) The Code: PHP: $player->getInventory()->setHelmet(Item::get(298, 0, 1));
did you blindly try to hack API version by allowing all alphas in plugin.yml? things changes when you update, and you are only suppose to accept said version when you actually have updated your plugin to work with latest version if you didnt get the note, each update changes things so yeah, it caused an error because update changes things consider upgrading your plugin to support it
PHP: $player->getArmorInventory()->setHelmet(Item::get(298, 0, 1)); And consider what @Thunder33345 said.
everything you need to know is here for each API version: https://github.com/pmmp/PocketMine-MP/releases