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

sleep() Alternative

Discussion in 'Development' started by SkyZone, Nov 27, 2016.

  1. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Read what I wrote!
    And if you still don't understand, instead of asking code to copy, try to fix them yourself! This is a forum for PocketMine plugin development. If your question is primarily related to PHP, not the PocketMine API, please don't ask it here.
     
    applqpak, BalAnce and HimbeersaftLP like this.
  2. BalAnce

    BalAnce Silverfish

    Messages:
    22
    GitHub:
    YaBoiBalAnce
    asuming your calling the schedule from the main class
    PHP:
    $this->getServer()->getScheduler()->schedulerepeatingtask(new sendTipTask($this),60); 
     
  3. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Please don't go offtopic.
     
  5. BalAnce

    BalAnce Silverfish

    Messages:
    22
    GitHub:
    YaBoiBalAnce
    Well it sorta made sense with your recent post
    |
    \/
     
  6. Bamuel

    Bamuel Silverfish

    Messages:
    16
    GitHub:
    bamuel
    Well look at my Pocketmine plugins, They never got accepted (in old PM-MP) since it legit breaks the whole system if an error occurred, and sleep(); isn't necessary bad prac for pm plugins
     
  7. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    I meant the while loop
     
  8. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    sleep() is almost always wrong. It is only valid when it is used in other threads. (It is actually rarely valid even if it is used in AsyncTask, since an AsyncTask should not be run for an indefinite time)
    Technically sleep() is similar to
    PHP:
    while(microtime(true) < $expireTime) continue;
     
    HimbeersaftLP likes this.
  9. SkyZone

    SkyZone Slime

    Messages:
    95
    Yes im using Netbeans
     
  10. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Why are you so good at getting off-topic? I just mentioned about IDE autocompletion and this turns into an IDE discussion thread...
     
    jasonwynn10 likes this.
  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.