Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[NewAPI] Plugin Error

Comments in 'Plugin Development' started by PluginMastered, Sep 8, 2014.

  1. PluginMastered
    Offline

    PluginMastered Active Member

    Joined:
    Mar 1, 2014
    Posts:
    161
    Minecraft User:
    Flexa33
    Hello Guys! I have decided to come back to coding pocketmine plugins so I have finally finished my plugin 'HealMe' but when I try too load and run it I always get this problem
    Code:
    02:05:57 [ERROR] An E_WARNING error happened: "yaml_parse(): scanning error encountered during parsing: mapping values are not allowed in this context (line 9, column 16)" in "/src/pocketmine/plugin/PluginDescription" at line 50
    02:05:57 [NOTICE] An E_RECOVERABLE_ERROR error happened: "Argument 1 passed to pocketmine\plugin\PluginDescription::loadMap() must be of the type array, boolean given, called in phar://C:/Users/Bleep/Desktop/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/plugin/PluginDescription.php on line 50 and defined" in "/src/pocketmine/plugin/PluginDescription" at line 58
    02:05:57 [ERROR] Could not load 'C:\Users\Bleep\Desktop\PocketMine-MP\plugins\HealMe' in folder 'C:\Users\beverly\Desktop\PocketMine-MP\plugins\': Invalid PluginDescription name
    
    I have looked around my plugin.yml and I have compared it to some examples and it looks fine to me the only thing I feel that is wrong is the permissions hereis my plugin.yml
    Code:
    name: HealMe
    version: 0.0.1
    api: [1.0.0]
    main: src\healme\main.php
    description: Heals you health when you do /heal
    commands: 
      heal: 
       description: Sets your health to 10 hearts
       usage: Usage: /heal 
       permission: HealMe.command.heal
    permissions: 
      HealMe.heal: 
        default: op
        description: lets Only ops heal
    
    and if its my Main.php then here its is.
    PHP:
    <?php
    namespace PluginMastered\healme
    use pocketmine\plugin\PluginBase
    use 
    pocketmine\command\CommandSender
    use 
    pocketmine\command\Command
    use 
    pocketmine\Player;  
    class 
    HealMe extends PluginBase {
       public function 
    onEnable() {
       
       }
       
       public function 
    onDisable() {
       
       }
       
       public function 
    onCommand(CommandSender $sender,Command $cmd,$label,array $args) {
       if(
    $sender instanceof Player) {
         switch(
    $cmd->getName()) {
           case 
    "heal":
               if (!(
    $sender instanceof Player)){ 
                          
    $sender->sendMessage("You do not have enough permissions to use this command!"); 
                         return 
    true
                      } 
                      
    $player $this->getServer()->getPlayer($sender->getName()); 
                      if (
    $player->hasPermission("healme.heal")){ 
                        
    $player->setHealth(20)
                          return 
    true
                      }

    }                

    I will also will leave this so you can test it the main.php . :(

    Attached Files:

    • main.php
      File size:
      1,021 bytes
      Views:
      7
  2. 64FF00
    Offline

    64FF00 Active Member Plugin Developer

    Joined:
    May 11, 2014
    Posts:
    298
    Plugins:
    2
    Minecraft User:
    64FF00
    Have you tried fixing 'usage: Usage: /heal' to 'usage: "/heal"' in plugin.yml?
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The "main" is your qualified class name (namespace + class name". Also, class and namespace names must be same as the folder/file path. Also, @shoghicp guaranteed to me that permission a.b.c must have parent a.b, and permission a.b must have parent a, or they will not be approved. Also, empty onEnable() and onDisable(l functions are unnecessary.
    Last edited: Sep 8, 2014
    Adaasi and 64FF00 like this.
  4. 64FF00
    Offline

    64FF00 Active Member Plugin Developer

    Joined:
    May 11, 2014
    Posts:
    298
    Plugins:
    2
    Minecraft User:
    64FF00
    Yep, those were also what I wanted to say :)
    Adaasi likes this.
  5. Adaasi
    Offline

    Adaasi Active Member

    Joined:
    Aug 14, 2014
    Posts:
    78
    Exact :D
    64FF00 likes this.

Share This Page

Advertisement