Hi, I m making a plugin and a error occurred the error is PHP: syntax error, unexpected ';' at line 299 And this is code PHP: switch ($action->getSlot()) { case 50: foreach (array_reverse($this->minionInformation->getInventory()->getContents(), true) as $slot => $item) { if(!$this->getPlayer()->getInventory()->contains(Item::get(Item::DIAMOND, 0, 136)){ /**Line229 **/ $this->getPlayer()->sendMessage("§1You don't have enough diamonds to upgrade.."); } $this->minionInformation->setLevel() - 2; $this->getPlayer()->sendMessage("§1Upgraded the minion!"); $this->getPlayer()->getInventory()->removeItem(Item::get(Item::DIAMOND, 0, 136); $player->removeWindow($action->getInventory()); } Please try to help me fast cuz I need this plugin so much And I'm using invmenu
I fixed it but another error occur. Error is here ⏬ PHP: 2021-03-16 [01:59:14] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected 'return' (T_RETURN)" (EXCEPTION) in "plugins/Aot's plugin (3).phar/src/DaPigGuy/PiggyMinions/entities/MinionEntity" at line 232 THE code is here PHP: if (!$player->getInventory()->contains(Item::get(Item::DIAMOND, 0, 136))){ $sender->sendMessage("§l§4You don't have required Items! ") return; }
Your missing a ; before the return Try this PHP: $sender->sendMessage("§l§4You don't have required Items! ");