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

Solved ClassNotFoundException

Discussion in 'Development' started by CreeperMonster, Aug 2, 2017.

  1. CreeperMonster

    CreeperMonster Slime

    Messages:
    81
    GitHub:
    CreeperMonster
    Can someone please explain or please fix my code for me

    PHP:
    <?php

    namespace creepermonster\Main;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\event\Listener;

    class 
    Main extends PluginBase implements Listener{
        public function 
    onLoad(){
            
    $this->getLogger()->info("TitlePE Loading");
        }
        public function 
    onEnable(){
            
    $this->getLogger()->info("TitlePE Enabled");
        }
        public function 
    onDisable(){
            
    $this->getLogger()->info("TitlePE Disabled");
        }
        public function 
    onJoin(PlayerJoinEvent $event) {
            
    $event->getPlayer()->addTitle("Welcome to""Server");
        }

    Error
    Code:
    [22:39:49] [Server thread/CRITICAL]: pocketmine\plugin\PluginException: "Couldn't load plugin titlepe: main class not found" (EXCEPTION) in "src/pocketmine/plugin/PharPluginLoader" at line 69
    [22:39:49] [Server thread/CRITICAL]: Could not load plugin 'titlepe' 
     
    Last edited: Aug 2, 2017
  2. xXSirButterXx

    xXSirButterXx Witch

    Messages:
    52
    GitHub:
    xxsirbutterxx
    Change "Main" to lower case because php is looking for "main" but only finds "Main"
     
    CreeperMonster likes this.
  3. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Your plugin.yml file indicates that the main file is lowercase, but there is no file with that name. Change the main file to a capital letter in the plugin.yml.
     
  4. xXSirButterXx

    xXSirButterXx Witch

    Messages:
    52
    GitHub:
    xxsirbutterxx
    forgot that :)
     
  5. CreeperMonster

    CreeperMonster Slime

    Messages:
    81
    GitHub:
    CreeperMonster
    Problem already Solved. Thanks
     
  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.