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

Class not found?

Discussion in 'Development' started by Atomization, Jul 23, 2018.

  1. Atomization

    Atomization Baby Zombie

    Messages:
    120
    GitHub:
    iAtomPlaza
    Hey, i have created another class dir to store my tasks in my plugin, but i get this error...

    Code:
    Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'cosmicWelcome v3.1': Class 'cosmicWelcome\tasks\Title' not found on cosmicWelcome\Main
    
    Error: "Class 'cosmicWelcome\tasks\Title' not found" (EXCEPTION) in "__cosmicWelcome/src/cosmicWelcome/Main" at line 66
    
    but i have wrote this at the beginning of the main
    PHP:
    use cosmicWelcome\tasks\Title;
    and my Title Class contains:
    PHP:
    <?php
    namespace cosmicWelcome;

    use 
    pocketmine\Player;
    use 
    pocketmine\scheduler\Task;
    use 
    pocketmine\utils\Config;


    class 
    Title extends Task{
        public 
    $player;

        public function 
    __construct($pluginPlayer $player){
            
    $this->plugin $plugin;
            
    $this->player $player;
        }

        public function 
    onRun($currentTick){
            
    $config = new Config($this->plugin->getDataFolder() . "config.yml"Config::YAML);

            
    $player $this->player;

            
    $title $this->plugin->replaceParameters($player$config->get("title"));
            
    $subtitle $this->plugin->replaceParameters($player$config->get("subtitle"));

            
    $fadein $config->get("fadein");
            
    $stay $config->get("stay");
            
    $fadeout $config->get("fadeout");
               
            
    $player->addTitle($title$subtitle$fadein$stay$fadeout);
                   
           
        }   
    }
    and i call the task at line 66 (seen though the error)
    PHP:
    $this->getScheduler()->scheduleDelayedTask(new Title($this$player), 40);
     
  2. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    PHP:
    <?php
    namespace cosmicWelcome\tasks;
     
    RumDaDuMCPE and Tee7even like 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.