1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Plugin that does not load.

Discussion in 'Development' started by ZakousseMC, Dec 19, 2016.

  1. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    Look at what it said
    see your plugin.yml
     
  2. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    I recommend using 2.1.0 if you want to use newer features like PlayerToggleFlightEvent. Usually this would be the case, but we've been forced to make so many changes it might not hold true this time. This is why I bumped to 3.0.0-ALPHA1 for 1.0.
     
    Primus likes this.
  3. ZakousseMC

    ZakousseMC Spider Jockey

    Messages:
    46
    GitHub:
    ZakousseMC
    What exactly, I can't find the error in plugin.yml

    PHP:
    nameAFKCommand
    main
    ZakousseMC\Main
    version
    1.0.0
    api
    : [2.0.02.1.0]
    descriptionAdds an /afk command that let you /afkThis is my first plugin.
    websitehttps://darknightpe.com
    authorZakousseMC
    commands
    :
     
    afk:
      
    descriptionVous rendre AFK.
      
    usage"/afk"
      
    permissionafk.command.afk
     
    permissions
    :
     
    afk:
      default: 
    op
      description
    "Vous laisse utiliser toutes les commandes que le plugin a."
      
    children:
       
    afk.command:
       
    description"Vous laisse utiliser la commande /afk"
       
    default: true

     
  4. ZakousseMC

    ZakousseMC Spider Jockey

    Messages:
    46
    GitHub:
    ZakousseMC
    I changed the plugin.yml a bit :

    PHP:
    nameAFKCommand
    main
    zakoussemc/afkplugin/main
    version
    1.0.0
    api
    : [2.0.02.1.0]
    descriptionAdds an /afk command that let you /afkThis is my first plugin.
    websitehttps://darknightpe.com
    authorZakousseMC
    commands
    :
     
    afk:
      
    descriptionVous rendre AFK.
      
    usage"/afk"
      
    permissionafk.command.afk
     
    permissions
    :
     
    afk:
      default: 
    op
      description
    "Vous laisse utiliser toutes les commandes que le plugin a."
      
    children:
       
    afk.command:
       
    description"Vous laisse utiliser la commande /afk"
       
    default: true

    Screenshot_3.jpg And the Main.php file is in "afkplugin" Screenshot_2.jpg
     
  5. kaliiks

    kaliiks Zombie

    Messages:
    250
    main: zakoussemc/afkplugin/Main use
     
  6. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
    I have fixed your plugin for you.
    Code:
    name: AFKCommand
    main: zakoussemc\afkplugin\Main
    version: 1.0.0
    author: ZakousseMC
    api: 2.0.0
    load: POSTWORLD
    description: Adds an /afk command that let you /afk. This is my first plugin.
    website: https://darknightpe.com
    
    commands:
     afk:
      description: Vous rendre AFK.
      usage: "/afk"
      permission: afk.command.afk
    
    permissions:
     afk:
      default: op
      description: "Vous laisse utiliser toutes les commandes que le plugin a."
      children:
       afk.command:
       description: "Vous laisse utiliser la commande /afk"
       default: true
    

    Corrected your PHP too...
    PHP:
    <?php
    namespace zakoussemc\afkplugin;

    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandExecutor;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\Player;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Server;
    use 
    pocketmine\utils\Config;
    use 
    pocketmine\utils\TextFormat;

    class 
    Main extends PluginBase {
    public function 
    onEnable() {
        @
    mkdir($this->getDataFolder());
        
    $this->saveDefaultConfig();
        
    $this->reloadConfig();
        
    $this->getLogger()->info(TextFormat::RED "its alive");
        }
     
    public function 
    translateColors($symbol$message) {
        
    $message str_replace($symbol."0"TextFormat::BLACK$message);
        
    $message str_replace($symbol."1"TextFormat::DARK_BLUE$message);
        
    $message str_replace($symbol."2"TextFormat::DARK_GREEN$message);
        
    $message str_replace($symbol."3"TextFormat::DARK_AQUA$message);
        
    $message str_replace($symbol."4"TextFormat::DARK_RED$message);
        
    $message str_replace($symbol."5"TextFormat::DARK_PURPLE$message);
        
    $message str_replace($symbol."6"TextFormat::GOLD$message);
        
    $message str_replace($symbol."7"TextFormat::GRAY$message);
        
    $message str_replace($symbol."8"TextFormat::DARK_GRAY$message);
        
    $message str_replace($symbol."9"TextFormat::BLUE$message);
        
    $message str_replace($symbol."a"TextFormat::GREEN$message);
        
    $message str_replace($symbol."b"TextFormat::AQUA$message);
        
    $message str_replace($symbol."c"TextFormat::RED$message);
        
    $message str_replace($symbol."d"TextFormat::LIGHT_PURPLE$message);
        
    $message str_replace($symbol."e"TextFormat::YELLOW$message);
        
    $message str_replace($symbol."f"TextFormat::WHITE$message);
     
        
    $message str_replace($symbol."k"TextFormat::OBFUSCATED$message);
        
    $message str_replace($symbol."l"TextFormat::BOLD$message);
        
    $message str_replace($symbol."m"TextFormat::STRIKETHROUGH$message);
        
    $message str_replace($symbol."n"TextFormat::UNDERLINE$message);
        
    $message str_replace($symbol."o"TextFormat::ITALIC$message);
        
    $message str_replace($symbol."r"TextFormat::RESET$message);
        return 
    $message;
        }
        
    // Acces aux permissions.
    private function access(CommandSender $sender$permission) {
        if(
    $sender->hasPermission($permission)) return true;
        
    $sender->sendMessage("Vous n'avez pas la permission d'utiliser cette commande.");
        return 
    false;
    }
    private function 
    inGame(CommandSender $sender,$msg true) {
        if (
    $sender instanceof Player) return true;
        if (
    $msg$sender->sendMessage("Vous pouvez seulement utiliser cette commande en jeu.");
        return 
    false;
    }
    public function 
    onCommand(CommandSender $senderCommand $cmd$label, array $args) {
        if(
    count($args) < 0)
        
    $sender->sendMessage(TextFormat::GREEN "Vous etes desormais AFK.");
        return 
    false;
    }
    }
    $this->getLogger()->info(TextFormat::RED . "its alive");
    This line above can be changed. Simply change the "its alive" with your own message. :)

    Make sure its in the folder & file path below:

    |- plugin.yml
    |
    |- src -- zakoussemc -- afkplugin -- Main.php.

    The names are CASE Sensitive, so be careful.
     
    Last edited: Dec 20, 2016
  7. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
    Cool! Thanks
     
  8. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    [​IMG]
    The part about api is not true. Writing api: 2.0.0 means that you support all API versions with major version (first number) 2 and minor version (second number) at least 0.
    Also the [] is not necessary because PocketMine will cast them to array. It is of course still good practice to always write them in the correct syntax.

    I have edited your post to fix this ridiculously false statement.
     
  9. ZakousseMC

    ZakousseMC Spider Jockey

    Messages:
    46
    GitHub:
    ZakousseMC
    When using this Main.php code this happens :
     

    Attached Files:

  10. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
    Make sure that there's is no space before and after the "<?php "
     
    HimbeersaftLP likes this.
  11. ZakousseMC

    ZakousseMC Spider Jockey

    Messages:
    46
    GitHub:
    ZakousseMC
    It works ! Thanks ! Topic can be closed
     
  12. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    try mark it sloved
     
  13. Magicode

    Magicode Baby Zombie

    Messages:
    183
    GitHub:
    magicode1
    I know that this isn't what this thread is about, but I just want to say something.
    It's Kinda long, so read the spoiler.

    I don't think that his post deserves to be labelled as "Ridiculously False"
    Other, fairly common plugins use the same:
    https://github.com/LegendOfMCPE/EssentialsPE/blob/master/plugin.yml

    But that's besides the thing I want to talk about.

    I don't think it is right to criticize people for what they post.

    Unless it is intentionally bad or harmful, open public criticism is not the way to help people, at least not in my view.

    When I first joined the Pocketmine forums, I borked a post I made about Plugins on Github. I didn't realize it was false, so I was super grateful when I saw this in my Conversations inbox:
    Screenshot 2016-12-20 at 10.27.36 AM.png

    @Intyre was super nice about it, and he let me know privately about my mistake. This prevented me from having to be publicly shamed for the sake of a small error.

    I know from experience that it can destroy your confidence to have your mistakes made public, and while it can be useful for large, group errors, individual mistakes (In my opinion) could be better solved using individual solution.

    It not just the post I quoted above, I have seen others, from other people, that are unnecessarily hurtful or rude. I mean, we are all learning on these forums, right? No need to criticize anyone who hasn't learned as much.

    I just realized I spent over an hour drafting this one response, because I don't want to offend anyone, that certainly is not my intention. I am also not trying to sound like a staff member, because honestly, this is just my two cents about things I have seen recently.

    Again, I can't stress enough that I don't want to insult anyone, or try to make up my own rules for the forums, I just wanted to get it out there about what I have seen. There are also amazing, awesome things that going in these forums, and I just want to keep (My focus at least) on helping people out.
     
  14. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    I agree completely! That example plugin wasn't exactly right though, I shouldn't have kept the 2.0.0 API there, as the vanish stuff messed up in 2.1.0, so I don't think that works fully in 2.0.0 :p That's kinda my fault.
     
    HimbeersaftLP and Magicode like this.
  15. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
    If we are not here to give help, or get help, then you are pretty much a nuisance.
     
    Magicode likes this.
  16. TheDragonRing

    TheDragonRing Witch

    Messages:
    64
    GitHub:
    dragonwocky
    Ah ok, sorry about that.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.