Who can help me Error in line 25 PHP: <?phpnamespace ItemFly\Nutzatvch;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\{Player, Server};use pocketmine\event\player\PlayerMoveEvent;use pocketmine\commands\{Command, ComamndSender};use pocketmine\inventory\Inventory;class Loader extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info("ItenFly Is Enabled"); $money = $this->getServer()->getPluginManager()->getPlugin("EconomyAPI"); } public function onMove(PlayerMoveEvent $e){ $player = $e->getPlayer(); $inventory = $player->getInventory();if($inventory->contains(Item::get(369, 200, 1))) { $p->setAllowFlight(true); }else{ if($p->setGamemode === 1){ }else{ $p->setAllowFlight(false); } if($p->getGamemode() === 1){ }else{ $p->setAllowFlight(false); } } } public function onComnand(CommandSender $p, Command $cmd, string $label, array $agrs):bool { if($cmd->getName() === "fly"){ if (!$sender instanceof Player){ $p->sendMessage($this->tag. "ใช้ในเกมเท่านั้น"); return true; } $this->MainForm($p); } return true; } public function MainForm($p){ $api = $this->getServer()->getPluginManger()->getPlugin("FormAPI"); $form = $api->createSimpleForm(function (Player $p, $data){ $result = $data; if($result === null){ return true; } switch($result){ case 0: $mymoney = $this->eco->myMoney($p); $moneys = $this->getConfig()->get("money"); if($money >= $moneys){ $this->eco->reduceMoney($sender, $moneys); $item = Item::get(369, 200, 1); $inv = $p-> getInventory(); $inv->addItem($item); }else{ $mymoney = $this->eco->myMoney($p);$moneys = $this->getConfig()->get("money"); $p->addTitle("§cเงินไม่พอ $mymoney ต้องการ $moneys"); } break; case 1: $p->addTitle("§aลา§bก่อน§cนะ§dครับ"); } }); $moneys = $this->getConfig()->get("money"); $form->setTitle("§bItem§aFly"); $form->addButton("§aกดเพื่อซื้อ! \n §r§oราคา$moneys"); $form->addButton("§cออก \n §r§oกดเพื่ออก"); $form->sendToPlayer($p); return $form; }}
PHP: <?phpnamespace ItemFly\Nutzatvch;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\{Player, Server};use pocketmine\event\player\PlayerMoveEvent;use pocketmine\commands\{Command, ComamndSender};use pocketmine\inventory\Inventory;class Loader extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info("ItenFly Is Enabled"); $money = $this->getServer()->getPluginManager()->getPlugin("EconomyAPI"); } public function onMove(PlayerMoveEvent $e){ $p = $e->getPlayer(); $inventory = $p->getInventory();if($inventory->contains(Item::get(369, 200, 1))) { // <-in line here I don't know to fix $p->setAllowFlight(true); }else{ if($p->setGamemode === 1){ }else{ $p->setAllowFlight(false); } if($p->getGamemode() === 1){ }else{ $p->setAllowFlight(false); } } } public function onComnand(CommandSender $p, Command $cmd, string $label, array $agrs):bool { if($cmd->getName() === "fly"){ if (!$sender instanceof Player){ $p->sendMessage($this->tag. "ใช้ในเกมเท่านั้น"); return true; } $this->MainForm($p); } return true; } public function MainForm($p){ $api = $this->getServer()->getPluginManger()->getPlugin("FormAPI"); $form = $api->createSimpleForm(function (Player $p, $data){ $result = $data; if($result === null){ return true; } switch($result){ case 0: $mymoney = $this->eco->myMoney($p); $moneys = $this->getConfig()->get("money"); if($money >= $moneys){ $this->eco->reduceMoney($sender, $moneys); $item = Item::get(369, 200, 1); $inv = $p-> getInventory(); $inv->addItem($item); }else{ $mymoney = $this->eco->myMoney($p);$moneys = $this->getConfig()->get("money"); $p->addTitle("§cเงินไม่พอ $mymoney ต้องการ $moneys"); } break; case 1: $p->addTitle("§aลา§bก่อน§cนะ§dครับ"); } }); $moneys = $this->getConfig()->get("money"); $form->setTitle("§bItem§aFly"); $form->addButton("§aกดเพื่อซื้อ! \n §r§oราคา$moneys"); $form->addButton("§cออก \n §r§oกดเพื่ออก"); $form->sendToPlayer($p); return $form; }}
Live Console FTP Version Logs ต่ออายุ / เปลี่ยน Plan [20:12:16 WebConsole]: Initializing console [20:12:16 WebConsole]: Connecting... [20:12:18 WebConsole]: Connected [13:12:16] [Server thread/NOTICE]: [EconomyAPI] Something went wrong on update server. [13:12:16] [Server thread/NOTICE]: [EconomyAPI] Database provider was set to: Yaml [13:12:16] [Server thread/INFO]: Starting GS4 status listener [13:12:16] [Server thread/INFO]: Setting query port to 18951 [13:12:16] [Server thread/INFO]: Query running on 0.0.0.0:18951 [13:12:16] [Server thread/INFO]: Default game type: Survival Mode [13:12:16] [Server thread/INFO]: Done (1.114s)! For help, type "help" or "?" [13:12:16] [Server thread/WARNING]: ----- PocketMine-MP Auto Updater ----- [13:12:16] [Server thread/WARNING]: Your version of PocketMine-MP is out of date. Version 3.9.7 was released on Mon Oct 28 04:09:40 2019 [13:12:16] [Server thread/WARNING]: Details: https://jenkins.pmmp.io/job/PocketMine-MP/1779/ [13:12:16] [Server thread/WARNING]: Download: https://jenkins.pmmp.io/job/PocketMine-MP/1779//artifact/PocketMine-MP.phar [13:12:16] [Server thread/WARNING]: ----- -------------------------- ----- [13:14:07] [Server thread/INFO]: nutzatvch[/171.4.236.139:43415] logged in with entity id 1 at (world, 308.1382, 66, 266.8228) [13:14:55] [Server thread/INFO]: nutzatvch joined the game [13:16:03] [Server thread/INFO]: [nutzatvch: Reloading server...] [13:16:03] [Server thread/INFO]: Saving worlds... [13:16:03] [Server thread/INFO]: Disabling FormAPI v1.3.0 [13:16:03] [Server thread/INFO]: Disabling EconomyAPI v5.7.2 [13:16:03] [Server thread/INFO]: Reloading properties... [13:16:03] [Server thread/INFO]: Loading DevTools v1.13.0 [13:16:03] [Server thread/INFO]: Loading FormAPI v1.3.0 [13:16:03] [Server thread/INFO]: Loading EconomyAPI v5.7.2 [13:16:03] [Server thread/INFO]: Enabling DevTools v1.13.0 [13:16:03] [Server thread/INFO]: Loading ItemFly v1 [13:16:03] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected '$p' (T_VARIABLE)" (EXCEPTION) in "plugins/ItemFly BuyUI/src/ItemFly/Nutzatvch/Loader" at line 24 [13:16:03] [Server thread/DEBUG]: #0 (): BaseClassLoader->loadClass(string[24] ItemFly\Nutzatvch\Loader) [13:16:03] [Server thread/DEBUG]: #1 (): spl_autoload_call(string[24] ItemFly\Nutzatvch\Loader) [13:16:03] [Server thread/DEBUG]: #2 src/pocketmine/plugin/PluginManager(180): class_exists(string[24] ItemFly\Nutzatvch\Loader, boolean 1) [13:16:03] [Server thread/DEBUG]: #3 src/pocketmine/plugin/PluginManager(344): pocketmine\plugin\PluginManager->loadPlugin(string[42] /home/mc_29561/18951/plugins/ItemFly BuyUI, array[1]) [13:16:03] [Server thread/DEBUG]: #4 plugins/PocketMine-DevTools.phar/src/DevTools/DevTools(49): pocketmine\plugin\PluginManager->loadPlugins(string[29] /home/mc_29561/18951/plugins/, array[1]) [13:16:03] [Server thread/DEBUG]: #5 src/pocketmine/plugin/PluginBase(123): DevTools\DevTools->onEnable() [13:16:03] [Server thread/DEBUG]: #6 src/pocketmine/plugin/PluginManager(588): pocketmine\plugin\PluginBase->setEnabled(boolean 1) [13:16:03] [Server thread/DEBUG]: #7 src/pocketmine/Server(2002): pocketmine\plugin\PluginManager->enablePlugin(object DevTools\DevTools) [13:16:03] [Server thread/DEBUG]: #8 src/pocketmine/Server(1988): pocketmine\Server->enablePlugin(object DevTools\DevTools) [13:16:03] [Server thread/DEBUG]: #9 src/pocketmine/Server(2071): pocketmine\Server->enablePlugins(integer 0) [13:16:03] [Server thread/DEBUG]: #10 src/pocketmine/command/defaults/ReloadCommand(49): pocketmine\Server->reload() [13:16:03] [Server thread/DEBUG]: #11 src/pocketmine/command/SimpleCommandMap(270): pocketmine\command\defaults\ReloadCommand->execute(object pocketmine\Player, string[6] reload, array[0]) [13:16:03] [Server thread/DEBUG]: #12 src/pocketmine/Server(2029): pocketmine\command\SimpleCommandMap->dispatch(object pocketmine\Player, string[6] reload) [13:16:03] [Server thread/DEBUG]: #13 src/pocketmine/Player(2231): pocketmine\Server->dispatchCommand(object pocketmine\Player, string[6] reload) [13:16:03] [Server thread/DEBUG]: #14 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(240): pocketmine\Player->chat(string[7] /reload) [13:16:03] [Server thread/DEBUG]: #15 src/pocketmine/network/mcpe/protocol/CommandRequestPacket(54): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleCommandRequest(object pocketmine\network\mcpe\protocol\CommandRequestPacket) [13:16:03] [Server thread/DEBUG]: #16 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(110): pocketmine\network\mcpe\protocol\CommandRequestPacket->handle(object pocketmine\network\mcpe\PlayerNetworkSessionAdapter) [13:16:03] [Server thread/DEBUG]: #17 src/pocketmine/network/mcpe/protocol/BatchPacket(123): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(object pocketmine\network\mcpe\protocol\CommandRequestPacket) [13:16:03] [Server thread/DEBUG]: #18 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(110): pocketmine\network\mcpe\protocol\BatchPacket->handle(object pocketmine\network\mcpe\PlayerNetworkSessionAdapter) [13:16:03] [Server thread/DEBUG]: #19 src/pocketmine/Player(3124): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(object pocketmine\network\mcpe\protocol\BatchPacket) [13:16:03] [Server thread/DEBUG]: #20 src/pocketmine/network/mcpe/RakLibInterface(169): pocketmine\Player->handleDataPacket(object pocketmine\network\mcpe\protocol\BatchPacket) [13:16:03] [Server thread/DEBUG]: #21 vendor/pocketmine/raklib/src/server/ServerHandler(99): pocketmine\network\mcpe\RakLibInterface->handleEncapsulated(string[19] 171.4.236.139 43415, object raklib\protocol\EncapsulatedPacket, integer 0) [13:16:03] [Server thread/DEBUG]: #22 src/pocketmine/network/mcpe/RakLibInterface(109): raklib\server\ServerHandler->handlePacket() [13:16:03] [Server thread/DEBUG]: #23 src/pocketmine/network/mcpe/RakLibInterface(99): pocketmine\network\mcpe\RakLibInterface->process() [13:16:03] [Server thread/DEBUG]: #24 vendor/pocketmine/snooze/src/SleeperHandler(123): pocketmine\network\mcpe\RakLibInterface->pocketmine\network\mcpe\{closure}() [13:16:03] [Server thread/DEBUG]: #25 vendor/pocketmine/snooze/src/SleeperHandler(85): pocketmine\snooze\SleeperHandler->processNotifications() [13:16:03] [Server thread/DEBUG]: #26 src/pocketmine/Server(2348): pocketmine\snooze\SleeperHandler->sleepUntil(double 1573046163.3953) [13:16:03] [Server thread/DEBUG]: #27 src/pocketmine/Server(2205): pocketmine\Server->tickProcessor() [13:16:03] [Server thread/DEBUG]: #28 src/pocketmine/Server(1784): pocketmine\Server->start() [13:16:03] [Server thread/DEBUG]: #29 src/pocketmine/PocketMine(274): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[21] /home/mc_29561/18951/, string[29] /home/mc_29561/18951/plugins/) [13:16:03] [Server thread/DEBUG]: #30 (1): require(string[90] phar:///usr/share/shareport/exec/mcpe/PocketMine-MP-120.phar/src/pocketmine/Pock) <-That Error
I can't find a syntax error in your code, could be a character encoding issue. But I noticed another mistake: The class properties "eco" and "tag" were not defined. Here, I formatted your code to make it more readable and fixed those errors, hopefully by copying it the encoding issue was fixed, too: PHP: <?phpnamespace ItemFly\Nutzatvch;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\{Player, Server};use pocketmine\event\player\PlayerMoveEvent;use pocketmine\commands\{Command, ComamndSender};use pocketmine\inventory\Inventory;class Loader extends PluginBase implements Listener{ private $eco; private $tag = "ItemFly"; public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info("ItenFly Is Enabled"); $this->eco = $this->getServer()->getPluginManager()->getPlugin("EconomyAPI"); } public function onMove(PlayerMoveEvent $e){ $p = $e->getPlayer(); $inventory = $p->getInventory(); if($inventory->contains(Item::get(369, 200, 1))) { $p->setAllowFlight(true); }else{ if($p->setGamemode === 1){ }else{ $p->setAllowFlight(false); } if($p->getGamemode() === 1){ }else{ $p->setAllowFlight(false); } } } public function onComnand(CommandSender $p, Command $cmd, string $label, array $agrs):bool { if($cmd->getName() === "fly"){ if (!$sender instanceof Player){ $p->sendMessage($this->tag. "ใช้ในเกมเท่านั้น"); return true; } $this->MainForm($p); } return true; } public function MainForm($p){ $api = $this->getServer()->getPluginManger()->getPlugin("FormAPI"); $form = $api->createSimpleForm(function (Player $p, $data){ $result = $data; if($result === null){ return true; } switch($result){ case 0: $mymoney = $this->eco->myMoney($p); $moneys = $this->getConfig()->get("money"); if($money >= $moneys){ $this->eco->reduceMoney($sender, $moneys); $item = Item::get(369, 200, 1); $inv = $p->getInventory(); $inv->addItem($item); }else{ $mymoney = $this->eco->myMoney($p); $moneys = $this->getConfig()->get("money"); $p->addTitle("§cเงินไม่พอ $mymoney ต้องการ $moneys"); } break; case 1: $p->addTitle("§aลา§bก่อน§cนะ§dครับ"); } }); $moneys = $this->getConfig()->get("money"); $form->setTitle("§bItem§aFly"); $form->addButton("§aกดเพื่อซื้อ! \n §r§oราคา$moneys"); $form->addButton("§cออก \n §r§oกดเพื่ออก"); $form->sendToPlayer($p); return $form; }} However it's unclear to me, what this part of the code is supposed to do: PHP: if($p->setGamemode === 1){ }else{ $p->setAllowFlight(false); } if($p->getGamemode() === 1){ }else{ $p->setAllowFlight(false); } While it's syntactically correct php, the Player class does not have a "setGamemode" property so that will crash the server anyways. Also, why are you writing empty "if" statements? Please tell me exactly what it's supposed to do, so we can fix it together.
[06:20:16] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected ' ' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)" (EXCEPTION) in "plugins/ItemFly BuyUI/src/ItemFly/Nutzatvch/Loader" at line 30 [06:20:16] [Server thread/DEBUG]: #0 (): BaseClassLoader->loadClass(string[24] ItemFly\Nutzatvch\Loader) [06:20:16] [Server thread/DEBUG]: #1 (): spl_autoload_call(string[24] ItemFly\Nutzatvch\Loader) [06:20:16] [Server thread/DEBUG]: #2 src/pocketmine/plugin/PluginManager(180): class_exists(string[24] ItemFly\Nutzatvch\Loader, boolean 1) [06:20:16] [Server thread/DEBUG]: #3 src/pocketmine/plugin/PluginManager(344): pocketmine\plugin\PluginManager->loadPlugin(string[42] /home/mc_30100/18601/plugins/ItemFly BuyUI, array[1]) [06:20:16] [Server thread/DEBUG]: #4 plugins/PocketMine-DevTools.phar/src/DevTools/DevTools(49): pocketmine\plugin\PluginManager->loadPlugins(string[29] /home/mc_30100/18601/plugins/, array[1]) [06:20:16] [Server thread/DEBUG]: #5 src/pocketmine/plugin/PluginBase(123): DevTools\DevTools->onEnable() [06:20:16] [Server thread/DEBUG]: #6 src/pocketmine/plugin/PluginManager(588): pocketmine\plugin\PluginBase->setEnabled(boolean 1) [06:20:16] [Server thread/DEBUG]: #7 src/pocketmine/Server(2002): pocketmine\plugin\PluginManager->enablePlugin(object DevTools\DevTools) [06:20:16] [Server thread/DEBUG]: #8 src/pocketmine/Server(1988): pocketmine\Server->enablePlugin(object DevTools\DevTools) [06:20:16] [Server thread/DEBUG]: #9 src/pocketmine/Server(1728): pocketmine\Server->enablePlugins(integer 0) [06:20:16] [Server thread/DEBUG]: #10 src/pocketmine/PocketMine(274): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[21] /home/mc_30100/18601/, string[29] /home/mc_30100/18601/plugins/) [06:20:16] [Server thread/DEBUG]: #11 (1): require(string[90] phar:///usr/share/shareport/exec/mcpe/PocketMine-MP-120.phar/src/pocketmine/Pock) [06:20:16] [Server thread/INFO]: Disabling DevTools v1.13.0 [06:20:16] [Server thread/INFO]: Preparing world "world" [06:20:16] [Server thread/INFO]: Enabling FormAPI v1.3.0 [06:20:16] [Server thread/INFO]: Starting GS4 status listener [06:20:16] [Server thread/INFO]: Setting query port to 18601 [06:20:16] [Server thread/INFO]: Query running on 0.0.0.0:18601 [06:20:16] [Server thread/INFO]: Default game type: Survival Mode [06:20:16] [Server thread/INFO]: Done (0.46s)! For help, type "help" or "?" That Error
I fixed the plugin, there were a lot of mistakes so I didn't bother marking them, please see for yourself and learn. PHP: <?phpdeclare(strict_types=1);namespace ItemFly\Nutzatvch;use jojoe77777\FormAPI\SimpleForm;use onebone\economyapi\EconomyAPI;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\item\Item;use pocketmine\event\Listener;use pocketmine\event\player\PlayerMoveEvent;use pocketmine\Player;use pocketmine\plugin\PluginBase;use pocketmine\utils\TextFormat;class Loader extends PluginBase implements Listener { private const TAG = "ItemFly"; /** * @var EconomyAPI */ private $eco; public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info("ItemFly Is Enabled"); $this->eco = EconomyAPI::getInstance(); } public function onMove(PlayerMoveEvent $e) { $p = $e->getPlayer(); $inventory = $p->getInventory(); if ($inventory->contains(Item::get(Item::BLAZE_ROD, 200, 1))) { $p->setAllowFlight(true); } else { if ($p->getGamemode() !== Player::CREATIVE) { $p->setAllowFlight(false); } } } public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args): bool { if ($cmd->getName() === "fly") { if (!$sender instanceof Player) { $sender->sendMessage(self::TAG . "ใช้ในเกมเท่านั้น"); return true; } $this->sendMainForm($sender); } return true; } public function sendMainForm(Player $p) { $moneys = $this->getConfig()->get("money"); $form = new SimpleForm(function (Player $p, $result) use ($moneys) { if ($result === null) { return; } switch ($result) { case 0: $mymoney = $this->eco->myMoney($p); if ($mymoney >= $moneys) { $this->eco->reduceMoney($p, $moneys); $item = Item::get(Item::BLAZE_ROD, 200, 1); $inv = $p->getInventory(); $inv->addItem($item); } else { $p->addTitle(TextFormat::RED . "เงินไม่พอ $mymoney ต้องการ $moneys"); } break; case 1: $p->addTitle(TextFormat::GREEN . "ลา" . TextFormat::AQUA . "ก่อน" . TextFormat::RED . "นะ" . TextFormat::LIGHT_PURPLE . "ครับ"); } }); $form->setTitle(TextFormat::AQUA . "Item" . TextFormat::GREEN . "Fly"); $form->addButton(TextFormat::GREEN . "กดเพื่อซื้อ! \n " . TextFormat::RESET . TextFormat::ITALIC . "ราคา$moneys"); $form->addButton(TextFormat::RED . "ออก \n " . TextFormat::RESET . TextFormat::ITALIC . "กดเพื่ออก"); $p->sendForm($form); }}