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

Solved Why my plugin doesn't work?

Discussion in 'Development' started by 7awariGamer, Mar 9, 2019.

  1. 7awariGamer

    7awariGamer Baby Zombie

    Messages:
    120
    GitHub:
    7awariGamer
    My plugin enabled in my server but it doesn't work, can u guys tell me where is the error?
    PHP:
    <?php
    //7.3.2019                   shari7             7Wdev

    namespace com\Joker7W;

    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\player\PlayerRespawnEvent;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\Player;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Server;
    use 
    pocketmine\utils\TextFormat;

    class 
    MainClass extends PluginBase implements Listener {

           public function 
    onEnable(){
                
    $this->getServer()->getPluginManager()->registerEvents($this$this);
                
    $this->getLogger()->info(TextFormat::GREEN "plugin works by 7awari");
           }

              public function 
    onDisable(){
                     
    $this->getLogger()->info(TextFormat::DARK_RED "error");
              }

                public function 
    onJoin(PlayerJoinEvent $e){
            
    $p $e->getEntity()->getPlayer();
                          
    $e->setJoinMessage("");
                          
    $p->sendMessage(TextFormat::YELLOW "Welcome To Our Server!");
                          
    $p->sendMessage(TextFormat::LIGHTBLUE "Plugin By 7awariGamer!");
                          
    $p->sendMessage(TextFormat::ORANGE "Plz Like + Subscribe + Share!");
                }

    }
    ?>
         
     
  2. Astro

    Astro Slime

    Messages:
    78
    GitHub:
    RealAstro
    the onJoin function must be before the onDisable Function
     
  3. 7awariGamer

    7awariGamer Baby Zombie

    Messages:
    120
    GitHub:
    7awariGamer
    Same, doesn't work ._.
     
  4. Aericio

    Aericio Slime

    Messages:
    99
    GitHub:
    aericio
    radondev likes this.
  5. 7awariGamer

    7awariGamer Baby Zombie

    Messages:
    120
    GitHub:
    7awariGamer
  6. Aericio

    Aericio Slime

    Messages:
    99
    GitHub:
    aericio
    PHP:
    $p $e->getEntity()->getPlayer();
    PHP:
    $p $e->getPlayer();
     
    jasonwynn10 likes this.
  7. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    send the plugin.yml and the file path too!
    >the onJoin function must be before the onDisable Function
    this is false; plugin function names can be put in any order
     
    jasonwynn10 and Aericio like this.
  8. 7awariGamer

    7awariGamer Baby Zombie

    Messages:
    120
    GitHub:
    7awariGamer
    Hmmmm , I will try ...
     
  9. 7awariGamer

    7awariGamer Baby Zombie

    Messages:
    120
    GitHub:
    7awariGamer
    Yes that what I know .
    I will upload it to GitHub , weird why the onjoin function doesn't work .
     
  10. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    please dont just use "dosent work"
    dosent work can mean a lot of things,

    you dont just say "the door dosent work"
    it might mean:
    the door is locked, cant be open
    the door fell off it's hinges
    the door handle is missing, thus cant be operated
    the door is jammed, thus blocked from opening

    see how "dosent work" can mean a lot of things?
    maybe you should say the PlayerJoinEvent dosent fire/wasnt triggered, also add an echo check maybe
    also does the "plugin works by 7awari" show on console?
    event
     
    jasonwynn10 likes this.
  11. 7awariGamer

    7awariGamer Baby Zombie

    Messages:
    120
    GitHub:
    7awariGamer
    Yes the plugin isis runni good in the console !
    all the functions works good except onjoin function!
    I mean the mistake is in the function "injoin" and IDK why / what is the error...
    And sorry for bad English ._.

    Here is the plugin source code :
    https://github.com/7Wdev/test3333
     
    Last edited: Mar 9, 2019
  12. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    can you add
    PHP:
    var_dump("onJoin");
    at the top of the onJoin function?
     
  13. 7awariGamer

    7awariGamer Baby Zombie

    Messages:
    120
    GitHub:
    7awariGamer
    Ok
     
  14. 7awariGamer

    7awariGamer Baby Zombie

    Messages:
    120
    GitHub:
    7awariGamer
    Doesn't work
     
  15. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    does it say anything on console?
     
  16. 7awariGamer

    7awariGamer Baby Zombie

    Messages:
    120
    GitHub:
    7awariGamer
    No just , the plugin loaded + enabled ...
     
  17. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    then your listener isn't registered
     
  18. 7awariGamer

    7awariGamer Baby Zombie

    Messages:
    120
    GitHub:
    7awariGamer
    How?? Hmmmm?
     
  19. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    contact me on discord KielKing#0946, we'll settle it there
     
  20. 7awariGamer

    7awariGamer Baby Zombie

    Messages:
    120
    GitHub:
    7awariGamer
    Accept my friend request
     
  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.