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

how to make a leave command without plugin crashing

Discussion in 'Development' started by WEATHERCRAFTYT1, Jul 1, 2020.

  1. JviguyGamesYT

    JviguyGamesYT Baby Zombie

    Messages:
    113
    GitHub:
    jviguy
    im not really doing the entire thing its not my plugin im just making a fork example for it
     
  2. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Baby Zombie

    Messages:
    121
    That’s fine with me
     
  3. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Baby Zombie

    Messages:
    121
    I just need that then I can pretty much do the rest
     
  4. Rim

    Rim Spider Jockey

    Messages:
    28
    GitHub:
    boomyourbang
    You can use Tasks. Tasks are always run at a set interval once scheduled. You can easily count the players in your game and run the task to update that count to players' view. See pocketmine\scheduler\Task. :)
     
  5. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Baby Zombie

    Messages:
    121
    How can I put that in the code.
     
  6. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    Just look at what plugins have a Task for that, you can create a class in new file.php (its better) or you can create it in your Main.php or what where do you want.
     
  7. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    Like this :
    PHP:
    private $GodWeedZao ;

        public function 
    __construct(Main $GodWeedZao )
        {
            
    $this->$GodWeedZao $GodWeedZao ;
        }

        public function 
    onRun(int $currentTick)
        {
            
    $this->plugin->Example();
    //Example is a function you created in Main.php to repeat task.
        
    }
    }
     
  8. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    its better to use it on new file.php in src in your own plugin.
    (i didnt write class, dont forget to use it, if you dont have ide)
     
  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.