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

Solved Main class not found

Discussion in 'Development' started by SJames, May 1, 2019.

  1. SJames

    SJames Spider Jockey

    Messages:
    35
    GitHub:
    sjamese
    Hello, I've been trying for an hour to get my plugin to work but it says that the main class can not be found. Hope you can help me.
     

    Attached Files:

  2. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
  3. SJames

    SJames Spider Jockey

    Messages:
    35
    GitHub:
    sjamese
    Plugin.yml
    PHP:
    nameUpCommand
    main
    SJames\UpCommand\Main
    api
    :
    3.7.3
    version
    0.1.0
    author
    SJames

    permissions
    :
      
    up:
        
    usage"/up"
        
    default: op
        description
    "Go up and put glass under your feet
    Main.yml
    PHP:
    <php
    namespace SJames\UpCommand;
    use 
    pocketmine\Blocks;
    use 
    pocketmine\Player;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Server;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\utils\TextFormat as c;
    use 
    pocketmine\Vector3

    class Main extends PluginBase {
      public function 
    onEnable(){
      }
      public function 
    onCommand(CommandSender $playerCommand $cmd String $label, array $args) :bool {
        switch(
    $cmd->getName()){
          case 
    "up"
            
    if(!($player instanceof Player)){
              
    $sender->sendMessage(c: :BOLD.c: :DARK_RED."Please run this command in-game.");
            }else{
              
    $x $player->getX();
              
    $z $player->getZ();
              
    $level $player->getLevel();
              
    $y $args[0]
              
    $coords = [$x$y$z];
              
    $player->teleport(new Vector3(...$coords));
            }      
          }
        }
      }
    }
     
    Last edited: May 1, 2019
  4. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    are they php files or .txt files
     
  5. SJames

    SJames Spider Jockey

    Messages:
    35
    GitHub:
    sjamese
    Plugin.yml
    And
    Main.php
     
  6. SleepSpace9

    SleepSpace9 Slime

    Messages:
    78
    GitHub:
    sleepspace9
    Your php tag is missing a question mark - the code in Main.php starts with <php instead of <?php .
     
  7. SJames

    SJames Spider Jockey

    Messages:
    35
    GitHub:
    sjamese
    Oh my God..finally.. Thank you so muuch!
     
    SleepSpace9 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.