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

Having a crash issue with a plugin im making.

Discussion in 'Development' started by xXSirButterXx, May 19, 2017.

  1. xXSirButterXx

    xXSirButterXx Witch

    Messages:
    52
    GitHub:
    xxsirbutterxx
    So i created a plugin recently and i need some help with crashes. Whenever i start the server i get this;

    [19:33:26] [Server thread/CRITICAL]: ClassNotFoundException: "Class titlejoin\main not found" (EXCEPTION) in "/src/spl/BaseClassLoader" at line 131

    Here's my code
    PHP:
    <?php

    namespace titlejoin;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\Player;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\scheduler\PluginTask;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;

    class 
    titlejoin extends PluginBase implements Listener{
     
        public 
    $title;
     
        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
            
    $this->saveDefaultConfig();
            
    $this->title $this->getConfig()->getNested('Title', []);
        }
        public function 
    onDisable(){
           
    $this->saveDefaultConfig();
        }
     
        public function 
    onCommand(CommandSender $sender,Command $cmd,$label,array $args){
            switch(
    strtolower($command->getName())){
                case 
    "tj":
            
    $this->player->sendTitle($title$subtitle,"60","3","20"); //fade in time (20=1 second), on screen time (seconds/ticks), fade out time
                
    break;
            }
            return 
    true;
        }
    }

    Download:
    https://www.dropbox.com/s/6liagpuiyczhf7l/titlejoin.zip?dl=0
     
    Last edited by a moderator: May 19, 2017
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    In your plugin.yml, change main: titlejoin\main to titlejoin\titlejoin. Pocketmine was searching for a main class that you gave the wrong path for.
     
    jasonwynn10 likes this.
  3. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Heyy, I just wanted to post that!

    P.S. @xXSirButterXx In the future please use code blocks for code and longer crashdumps(look here if you want to know how to use them
     
    Last edited by a moderator: May 19, 2017
    jasonwynn10 and corytortoise like this.
  4. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    and another one for the facepalm section...
     
  5. xXSirButterXx

    xXSirButterXx Witch

    Messages:
    52
    GitHub:
    xxsirbutterxx
    Lol. I'm still relatively new to the forums. I was trying to figure out how to make code blocks.
     
  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.