Hi, i just started to make PocketMine's plugin but i got this error in my console log Code: 26.07 02:34:33 [Server] INFO Warning: yaml_parse(): scanning error encountered during parsing: could not find expected ':' (line 30, column 19), context while scanning a simple key (line 29, column 7) in phar:///jar/genisys.phar/src/pocketmine/plugin/PluginDescription.php on line 53 26.07 02:34:33 [Server] INFO Warning: yaml_parse(): Unexpected event type 0 (line 30, column 19) in phar:///jar/genisys.phar/src/pocketmine/plugin/PluginDescription.php on line 53 26.07 02:34:33 [Server] INFO Warning: yaml_parse(): Unexpected event type 0 (line 30, column 19) in phar:///jar/genisys.phar/src/pocketmine/plugin/PluginDescription.php on line 53 26.07 02:34:33 [Server] INFO Warning: yaml_parse(): Unexpected event type 0 (line 30, column 19) in phar:///jar/genisys.phar/src/pocketmine/plugin/PluginDescription.php on line 53 26.07 02:34:33 [Server] Server thread/ERROR Could not load '/plugins/Quest' in folder '/plugins/': Argument 1 passed to pocketmine\plugin\PluginDescription::loadMap() must be of the type array, boolean given, called in phar:///jar/genisys.phar/src/pocketmine/plugin/PluginDescription.php on line 53 26.07 02:34:33 [Server] Server thread/CRITICAL TypeError: "Argument 1 passed to pocketmine\plugin\PluginDescription::loadMap() must be of the type array, boolean given, called in phar:///jar/genisys.phar/src/pocketmine/plugin/PluginDescription.php on line 53" (EXCEPTION) in "/src/pocketmine/plugin/PluginDescription" at line 61 Here is my QuestMain.php: PHP: <?phpnamespace Quest;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\utils\TextFormat;use pocketmine\inventory\InventoryHolder;use pocketmine\inventory\PlayerInventory;use pocketmine\utils\Config;use pocketmine\Player;use onebone\economyapi\EconomyAPI;class Main extends PluginBase implements Listener{ // Plugin All Based on EconomyJob private $quest; private $player; private $eapi; public function onLoad(){ $this->getLogger()->info("[Quest]Loading..."); } public function onEnable(){ // make files if it doesn't exist and read it if it exist @mkdir($this->getDataFolder()); if(!is_file($this->getDataFolder()."quests.yml")){ $this->quests = new Config($this->getDataFolder()."quests.yml", Config::YAML, yaml_parse($this->readResource("quests.yml"))); }else{ $this->quests = new Config($this->getDataFolder()."quests.yml", Config::YAML); } $this->player = new Config($this->getDataFolder()."players.yml", Config::YAML); $this->getServer->getPluginManager()->registerEvents($this,$this); $this->getLogger()->info("[Quest]Plugin Enabled!"); // get EconomyAPI $this->api = EconomyAPI::getInstance(); } // read resources private function readResource($re){ $path = $this->getFile()."resources/".$re; $resource = $this->getResource($re); if(!is_resource($resource)){ $this->getLogger()->debug("Tried to load unknown resource ".TextFormat::AQUA.$res.TextFormat::RESET); return false; } $content = stream_get_contents($resource); @fclose($content); return $content; } public function onDisable(){ $this->player->save $this->quests->save } public function onCommand(CommandSender $sender, Command $command, $label, array $args, $event, $questname){ $qu = $this->quests->get($questnames); switch(array_shift($args)){ case "join": if($sender->hasPermission("quest.command.join.use".$questname){ if(!$sender instanceof Player){ $sender->sendMessage("Please run this command in-game."); } if($this->player->exists($sender->getName())){ $sender->sendMessage("You already have joined this quest."); }else{ $quest = array_shift($args); if(trim($quest) === ""){ $sender->sendMessage("Usage: /quest join <name>"); break; } if($this->quests->exists($quest)){ $this->player->set($sender->getName(), $quest); $sender->sendMessage("Quest \"$quest\" has successful added to your Quests list"); }else{ $sender->sendMessage("Quest \"$quest\" isn't avalible"); } } } break; case "leave": if(!$sender instanceof Player){ $sender->sendMessage("Please run this command in-game."); } if($this->player->exists($sender->getName())){ $quest = $this->player->get($sender->getName()); $this->player->remove($sender->getName()); $sender->sendMessage("Quest \"$quest\" has been removed from your Quest list"); $sender->sendMessage("Try hard next time!"); }else{ $sender->sendMessage("Quest isn't avaliable in your Quest list"); } break; case "list": if(!$sender instanceof Player){ $sender->sendMessage("Please run this command in-game."); } if($this->player->exists($sender->getName())){ $sender->sendMessage("Your Currect Quest : ".$this->player->get($sender->getName())); }else{ $sender->sendMessage("You haven't Join Any Quest"); } break; case "finish": if(!$sender instanceof Player){ $sender->sendMessage("Please run this command in-game."); } if($this->player->exists($sender->getName())){ $player = $event->getPlayer(); $block = $event->getBlock(); $inventory = $player->getInventory(); $inv = $inventory->getContents(); $quest = $this->quests->get($this->player->get($player->getName())); $blockID = $quest[$block->getID()]; $blockAmount = $quest[$block->getCount()]; if($quest !== false){ if(isset($quest[$block->getID().":".$block->getCount()."])){ if($inv->getId() == $blockID && $inv->getCount() >= $blockAmount) { $sender->sendMessage(TextFormat::GOLD."Voltage".TextFormat::GRAY."Prison>>" TextFormat::BLUE."Price Received"); $money = $quest[$block->getID().":".$block->getCount()."]; if($money > 0){ $this->eapi->addMoney($player, $money); $this->player->remove($sender->getName()); } else { $this>eapi->reduceMoney($player, $money); } } } } else { $sender->sendMessage("You Didn't Joined a Quest yet."); } break; } } public function questIsComplete($item, $inventory, $player, $event) { $player = $event->getPlayer(); $block = $event->getBlock(); $inventory = $player->getInventory(); $inv = $inventory->getContents(); $quest = $this->quests->get($this->player->get($player->getName())); $blockID = $quest[$block->getID()]; $blockAmount = $quest[$block->getCount()]; if($quest !== false){ if(isset($quest[$block->getID().":".$block->getCount()."])){ $money = $quest[$block->getID().":".$block->getCount()."]; if($inv->getId() == $blockID && $inv->getCount() >= 64) { $sender->sendMessage(TextFormat::GOLD."Voltage".TextFormat::GRAY."Prison>>" TextFormat::GREEN."Quest completed, use /quest finish to finish the quest and receive price"); } } } }} And here is my plugin.yml : Code: name: Quest main: Quest\QuestMain version: "1.0.0" api: 2.0.0 author: JonsMC description: Quest Plugin commands: quest: description: quest main command usage: /quest [join/leave/list] permission: quest.command.quest permissions: quest.command.*: description: Allows player to use all of quest command default: op children: quest.command.quest: description: Allows player to use /quest command default: true children: quest.command.quest.leave: description: Allows player to use command that allows to leave quest default: true quest.command.quest.list: description: Allows player to use command that allows to see user quest default: true quest.command.finish description: Allow player to finish their quest default: true quest.command.quest.join: description: Allows player to use command that allows to join quest default: true children: quest.command.quest.join.use. description: Allow player to join a quest default: false What is wrong with my plugin? This plugin is based on onebone's EconomyJob plugin
Now it gave me this error Code: Server thread/CRITICAL ParseError: "syntax error, unexpected '$this' (T_VARIABLE)" (EXCEPTION) in "/Quest/src/Quest/QuestMain" at line 57 Crashdump: Code: Genisys Crash Dump Tue Jul 26 02:58:14 PDT 2016 Error: syntax error, unexpected '$this' (T_VARIABLE) File: /Quest/src/Quest/QuestMain Line: 57 Type: notice THIS CRASH WAS CAUSED BY A PLUGIN Code: [48] return false; [49] } [50] $content = stream_get_contents($resource); [51] @fclose($content); [52] return $content; [53] } [54] [55] public function onDisable(){ [56] $this->player->save [57] $this->quests->save [58] } [59] [60] public function onCommand(CommandSender $sender, Command $command, $label, array $args, $event, $questname){ [61] [62] $qu = $this->quests->get($questnames); [63] [64] switch(array_shift($args)){ [65] case "join": [66] if($sender->hasPermission("quest.command.join.use".$questname){ [67] if(!$sender instanceof Player){ Backtrace: #0 (): spl_autoload_call(string Quest\QuestMain) #1 /src/pocketmine/plugin/FolderPluginLoader(48): class_exists(string Quest\QuestMain, boolean 1) #2 /src/pocketmine/plugin/PluginManager(155): pocketmine\plugin\FolderPluginLoader->loadPlugin(string /home/minecraft/multicraft/servers/server17/plugins/Quest) #3 /src/pocketmine/plugin/PluginManager(333): pocketmine\plugin\PluginManager->loadPlugin(string /home/minecraft/multicraft/servers/server17/plugins/Quest, array Array()) #4 /src/pocketmine/Server(2031): pocketmine\plugin\PluginManager->loadPlugins(string /home/minecraft/multicraft/servers/server17/plugins/) #5 /src/pocketmine/PocketMine(467): pocketmine\Server->__construct(pocketmine\CompatibleClassLoader object, pocketmine\utils\MainLogger object, string phar:///home/minecraft/multicraft/jar/genisys.phar/, string /home/minecraft/multicraft/servers/server17/, string /home/minecraft/multicraft/servers/server17/plugins/, string unknown) #6 (1): require_once(string phar:///home/minecraft/multicraft/jar/genisys.phar/src/pocketmine/PocketMine.php) Genisys version: 0909f533a4652606107c420de530bfd46a848d70 [Protocol 81; API 2.0.0] uname -a: Linux voltage.nether.co 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 PHP version: 7.0.3 Zend version: 3.0.0 OS : Linux, linux Server uptime: 0 seconds Number of loaded worlds: 0 Players online: 0/60 Loaded plugins:
You forgot 2 semicolon,look at function onDisable(): PHP: $this->player->save $this->quests->save It must be: PHP: $this->player->save; $this->quests->save;
and also: doing PHP: $this->player->save; you are only accessing a variable and not using it i think what would you like to do is calling a function PHP: $this->player->save();