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

scheduleTask

Comments in 'Plugin Development' started by Angelo Vidrio, Jan 24, 2015.

  1. Angelo Vidrio
    Offline

    Angelo Vidrio Active Member Plugin Developer

    Joined:
    Jan 16, 2014
    Posts:
    123
    Plugins:
    5
    Minecraft User:
    LilCrispy45
    I need some help with my schedule task, is there any way to do/run code when the task has timed out?
    PHP:
    <?php



    namespace Exsample;


    use 
    pocketmine\Server;
    use 
    pocketmine\scheduler\PluginTask;
    use 
    pocketmine\utils\TextFormat;


    class 
    VanishTask extends PluginTask{
        public function 
    __construct(Main $plugin$user){
            
    parent::__construct($plugin);
            
    $this->plugin $plugin;
            
    $this->user $user;
        }
       
       
        public function 
    onRun($currentTick){
            
    $time $this->plugin->getConfig()->get("Time");
            if(
    $time 0) {
                
    $this->plugin->hideUser($this->user);
            }else{
                return 
    true;
            }
        }
    }
    ?>
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What do you mean "timed out"?
    Is the task a repeated one or a delayed one?
    Angelo Vidrio likes this.
  3. Angelo Vidrio
    Offline

    Angelo Vidrio Active Member Plugin Developer

    Joined:
    Jan 16, 2014
    Posts:
    123
    Plugins:
    5
    Minecraft User:
    LilCrispy45
    Nvm, i figured it out, thanx for trying to help though!
  4. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Don't use any
    PHP:
     ?> 
    at the end of classes... I don't know why, but @shoghi recommend to not use them xD
    PEMapModder, xFlare and Angelo Vidrio like this.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Because ?> is only for files that are supposed to be webpage files.
    Angelo Vidrio likes this.
  6. Angelo Vidrio
    Offline

    Angelo Vidrio Active Member Plugin Developer

    Joined:
    Jan 16, 2014
    Posts:
    123
    Plugins:
    5
    Minecraft User:
    LilCrispy45
    Thanks, can you take a look at my new post please? :)

Share This Page

Advertisement