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

Error: Class

Comments in 'Plugin Development' started by Cool_Man0001, Oct 17, 2015.

  1. Cool_Man0001
    Offline

    Cool_Man0001 New Member

    Joined:
    Aug 12, 2015
    Posts:
    6
    Minecraft User:
    JohnPlaysMcpe
    hey guys,
    I am getting the error
    Code:
    Error: Class
    Flower\hello\Main
    not found
    File:
    /src/spl/BaseClassLoader
    Line:144
    Type: Notice
    My code
    PHP:
    <?php

    namespace FlowerHello;

    use 
    pocketmine\command\Command;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\event\player\PlayerCommandPreproccessEvent;

    class 
    Main extends PluginBase implements Listener {

        public function 
    onEnable() {
             
    $this->getServer()->getPluginManager()->registerEvents($this$this);
       }
      
       public function 
    onChat(PlayerCommandPreproccessEvent $event) {
           
    $player $event->getPlayer();
           
    $chat explode(" "strtolower($event->getMessage()));
           if(
    $chat[0] == "/me" || $chat[0] == "/help")
               
    $player->sendMessage("You dont have permmision to use this command!");
           
    $event->setCancelled();
       }
       public function 
    onCommand(CommandSender $playerCommand $command$label, array $args) {
       if(
    strtolower($command->getName() == "h")){
               
    $player->sendMessage(TextFormat::BOLDTextFormat::BLUE "Hey" $player);
               
    $player->sendMessage(TextFormat::BOLDTextFormat::BLUE "Welcome");
             if(empty(
    $args)) {
                  
    $player->sendMessage(("Please use /h for help"));
                   return 
    true;
                               }
                   return 
    false;
      }
       }
           }
    my plugin.yml
    PHP:
    nameHelp
    version
    1.0.0
    author
    Flower
    api
    1.12.1
    main
    Flower\hello\Main
    commands
    :
        
    h:
            
    descriptionalternative to /help
            usage
    : /h
         
    Last edited: Oct 17, 2015
  2. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Post the full code and error log, or else we won't be able to help you.
    Cool_Man0001 likes this.
  3. Cool_Man0001
    Offline

    Cool_Man0001 New Member

    Joined:
    Aug 12, 2015
    Posts:
    6
    Minecraft User:
    JohnPlaysMcpe
    That is the full code. I just want to know if there are any errrors
  4. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    That is not the full code. Where's your namespace?
    Cool_Man0001 likes this.
  5. Cool_Man0001
    Offline

    Cool_Man0001 New Member

    Joined:
    Aug 12, 2015
    Posts:
    6
    Minecraft User:
    JohnPlaysMcpe
    I updated my first post
  6. Cool_Man0001
    Offline

    Cool_Man0001 New Member

    Joined:
    Aug 12, 2015
    Posts:
    6
    Minecraft User:
    JohnPlaysMcpe
    are you sure its related to this crash Dump
    Code:
    Code:
    
    [135]
    [136]
    if(\method_exists($name, "onClassLoaded") and (new ReflectionClass($name))-.getMethod("onClassLoaded")->isStatic()){
    [137]
    $name::onCLassLoaded();
    [138]
    [139]
    [140]
    $this->classes[] = $name;
    [141]
    [142] return\true;
    [143] }elseif($this->getParent() === \null){
    [144] throw new ClassNotFoundException("Class $name not found");
    [145] }
    [146]
    [147] return\false;
    [148] }
    [149]
    [150] /**
    [151] * Returns the path for the class if any
    [152] *
    [153] * @params string $name
    [154] *
    
    Backtrace:
    #o ():
    spl_autoload_call(string Flower\hello\Main)
    #1 /src/pocketmine/plugin/PharPluginLoaded(64): class_exists(string Flower\hello\Boolean 1)
    #2 /src/pocketmine/plugin/PluginManager(152):
    
  7. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    You have:

    PHP:
    namespace FlowerHello;
    Which is wrong because, 1. there is a space betwen Flower\ and Hello. 2. You have there "Hello" but you have "hello" in the plugin.yml.
    zombie_Power and PEMapModder like this.
  8. Cool_Man0001
    Offline

    Cool_Man0001 New Member

    Joined:
    Aug 12, 2015
    Posts:
    6
    Minecraft User:
    JohnPlaysMcpe
    hey I got this error
    Code:
    "Class Flower\hello\Main not found" (EXCEPTION) in "/src/spl/BaseClassLoader" at line 144
    23.10 03:05:45 [Server] Server thread/CRITICAL Unhandled exception executing command 'reload' in reload: Class Flower\hello\Main not found
    
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    /reload doesn't update your plugin. PHP is unable to unload a class and then load it again. (I had heard of an extension doing that, but I also remember @shoghicp had pointed out its disadvantages more than one year ago)
  10. Cool_Man0001
    Offline

    Cool_Man0001 New Member

    Joined:
    Aug 12, 2015
    Posts:
    6
    Minecraft User:
    JohnPlaysMcpe
    Can you please help me? :( I use your pmt.mcpe.me :D (it is awesome), but it also shows the same issue.:(
    Last edited: Oct 23, 2015
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Restart your server, don't /reload.

Share This Page

Advertisement