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

Scheduler got error for new api ?

Discussion in 'Development' started by Nora1903, Jun 11, 2018.

  1. Nora1903

    Nora1903 Slime

    Messages:
    82
    GitHub:
    cuongvnz
    I just used some plugins that already working in old api for new server pmmp with api 3.0.0-ALPHA and now these plugin got same error :

    Code:
    Error: "Call to undefined method pocketmine\Server::getScheduler()" (EXCEPTION) in "PocketRPG_v0.3.0/src/PocketRPG/Main" at line 37
    Code of line with error :
    PHP:
    public function onEnable() {
        
    $this->getLogger()->info(TF:: GREEN "Enabling PocketRPG");
        
    $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this);
        
    $this->getCommand("rpg")->setExecutor(new RpgCommands($this));
        
    $this->getCommand("quest")->setExecutor(new QuestCommands($this));
        
    $this->getCommand("party")->setExecutor(new PartyCommands($this));
       
    /*line 37 */ $this->getServer()->getScheduler()->scheduleRepeatingTask (new ManaTask($this), 40);
      
        @
    mkdir($this->getDataFolder());
        
    $this->saveResource("config.yml");
        
    $this->config = new Config($this->getDataFolder(). "config.yml"Config::YAML);
      }
    Please help me how to fix@@@
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Consequences of using unstable PMMP releases without going through the changes?
    https://github.com/pmmp/PocketMine-MP/pull/2213
     
  3. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    don't use development builds if you don't know what you're doing...

    wonders if he ought to add a kill switch to dev builds to stop noobs running them
     
    xXNiceAssassinlo YT, Muqsit and SOFe like this.
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    If build isn't tagged, download a developer quiz question.
     
    Muqsit, HimbeersaftLP and dktapps like this.
  5. Nora1903

    Nora1903 Slime

    Messages:
    82
    GitHub:
    cuongvnz
    I fixed but now i have another error
    Code:
    Error: "Cannot call constructor" (EXCEPTION) in "PocketRPG_v0.3.0/src/PocketRPG/tasks/ManaTask" at line 16

    PHP:
    use PocketRPG\Main;
    use 
    pocketmine\scheduler\Task;
    use 
    pocketmine\scheduler\TaskScheduler;
    use 
    pocketmine\scheduler\TaskHandler;
    use 
    pocketmine\Player;
    use 
    pocketmine\Server;
    use 
    pocketmine\utils\Config;

    class 
    ManaTask extends Task {

      public function 
    __construct(Main $plugin) {
      
    /*line16*/  parent::__construct ($plugin);
        
    $this->plugin $plugin;
      }
     
  6. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Task class has no constructor, you're trying to call Task class's constructor on that line. https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/scheduler/Task.php
     
  7. Nora1903

    Nora1903 Slime

    Messages:
    82
    GitHub:
    cuongvnz
  8. Epic

    Epic Creeper

    Messages:
    4
    basically, just remove the constructor (the whole line 16)
     
    SOFe 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.