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

Plugin Help

Comments in 'Plugin Development' started by Falk, Oct 25, 2013.

  1. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I have come to need a plugin that does a simple task every few minutes. I really am new to the PocketMine API. Could anyone setup a barebones document with a function being executed every 10 minutes.
    Last edited: Oct 25, 2013
  2. JWhy
    Offline

    JWhy New Member

    Joined:
    Oct 21, 2013
    Posts:
    13
    Minecraft User:
    I don't play MCPE :P
    wies likes this.
  3. Humerus
    Offline

    Humerus Staff Member Plugin Reviewer

    Joined:
    Aug 23, 2013
    Posts:
    114
    Plugins:
    1
    Or you could just use the schedule functions.
    PHP:
    $this->api->schedule({mins}*1200, array($this"{functionname}"), array(), true);
    Last edited: Oct 26, 2013
  4. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    That look a lot simpler :p
  5. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    So that will run foo(); every blah minutes?
  6. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    Do you know how to parse $api in the thread construct?
    I always get the error that he can't serialize a PDO object
  7. JWhy
    Offline

    JWhy New Member

    Joined:
    Oct 21, 2013
    Posts:
    13
    Minecraft User:
    I don't play MCPE :P
    Code:
    Warning: SQLite3::query(): The SQLite3 object has not been correctly initialised
    in <server_dir>\src\PocketMinecraftServer.php on line 144
    
    Warning: SQLite3::lastErrorMsg(): The SQLite3 object has not been correctly initialised in <server_dir>\src\PocketMinecraftServer.php on line 144
    23:01:06 [ERROR] [SQL Error] . Query: SELECT ID FROM tiles WHERE level = 'world';
    Are your errors related to those?
  8. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    No,
    Code:
    'Uncaught exception \'PDOException\' with message \'You cannot serialize or unserialize PDO instances\'
    And here's an example of the code:
    PHP:
    class TestThread extends Thread{
        private 
    $api;
        public function 
    __construct($api){
            
    $this->api $api;
        }

        public function 
    run(){
            
    $this->api->chat->broadcast("test");
        }
    }
    Last edited: Oct 27, 2013
  9. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
  10. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Yep, I reported it earlier
  11. Qub1
    Offline

    Qub1 New Member

    Joined:
    Nov 6, 2013
    Posts:
    16
    Minecraft User:
    Qub1
    I did get some errors like those, what can be done to fix them?

Share This Page

Advertisement