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

{NEW API} Schedules

Comments in 'Plugin Development' started by Killman2, Jul 26, 2014.

  1. Killman2
    Offline

    Killman2 Active Member Plugin Developer

    Joined:
    May 5, 2014
    Posts:
    81
    Plugins:
    1
    Minecraft User:
    Killman2
    Hello. I need some help. How schedules work now? How do you create them?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Search for similar threads

    P.S. @shoghicp is back! He has NaN notifications this week!
    Darunia18, onebone and iJoshuaHD like this.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    BTW how to use timings?
  4. Minetox
    Offline

    Minetox New Member

    Joined:
    Jun 23, 2014
    Posts:
    31
    Minecraft User:
    Minetox
    PHP:
    <?php
     
    namespace Example;
     
     
    use 
    pocketmine\utils\TextFormat as MT;
    use 
    pocketmine\scheduler\PluginTask;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\server;
     
     
     
    class 
    Example extends PluginBase
    {
           
            public function 
    onLoad()
            {
            }
           
            public function 
    onEnable()
            {
                    
    $this->getLogger()->info(MT::BLUE "[MineTox]" MT::RED "The Scheduler" MT::BLUE " has been loaded");
                    
    $this->getServer()->getScheduler()->scheduleRepeatingTask(new ExampleTask($this), 20); //20 = 1 second, 1200 = 1 minute
            
    }
           
            public function 
    onDisable()
            {}
     
    }
     
    class 
    ExampleTask extends PluginTask
    {
     
        public function 
    __construct(Example $plugin){
        }
     
        public function 
    onRun($currentTick){
            
    Server::getInstance()->broadcastMessage("This Message will broadcast every Second!");
            }
           
    }
    swagboy47 likes this.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    How many times have I said, why does everyone add empty onDisable() and onLoad() functions in their plugins?
    Falk and 64FF00 like this.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I think you just need to show the schedule part.

Share This Page

Advertisement