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

Solved Why do I have this error?

Discussion in 'Development' started by DiamondGamer30, Oct 29, 2017.

  1. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    I don't understand why I have this error.

     
  2. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    Because your plugin has a syntax error
     
  3. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    That's my plugin

    PHP:
    <?php

    namespace AmplfiedApples\Main;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Server;
    use 
    pocketmine\Player;
    use 
    pocketmine\event\player\PlayerItemConsumeEvent;
    use 
    pocketmine\entity\Effect;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\item\Item;

    class 
    Main extends PluginBase implements Listener {
     
        public function 
    onEnable() {
            
    $this->getLogger()->info("AmplifiedApples was enabled. Plugin by DiamondGamer30");
        }
     
        public function 
    onDisable() {
            
    $this->getLogger()->warning("AmplifiedApples were disabled!")
        }

        public function 
    onConsume(PlayerItemConsumeEvent $event) {
        if(
    $event->getItem()->getId() === 466) {
      
                
    $player $event->getPlayer;

                
    $player->addEffect(Effect::getEffect(10)->setAmplifier(3)->setDuration(20)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(12)->setAmplifier(1)->setDuration(100)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(5)->setAmplifier(1)->setDuration(100)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(22)->setAmplifier(3)->setDuration(100)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(23)->setAmplifier(3)->setDuration(100)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(1)->setAmplifier(1)->setDuration(15)->setVisible(true));
                
    $player->addTitle("§5You have consumed a""§d§lGod Apple")
            }
            if(
    $event->getItem()->getId() === 322) {
          
                
    $player $event->getPlayer;

                
    $player->addEffect(Effect::getEffect(10)->setAmplifier(2)->setDuration(10)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(12)->setAmplifier(1)->setDuration(10)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(5)->setAmplifier(1)->setDuration(10)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(22)->setAmplifier(3)->setDuration(10)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(23)->setAmplifier(3)->setDuration(10)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(1)->setAmplifier(1)->setDuration(5)->setVisible(true));
                
    $player->addTitle("§5You have consumed a""§d§lGolden Apple")
            }
        }
    }
     
  4. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    You forgot some semicolons:
    PHP:
    <?php

    namespace AmplfiedApples\Main;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Server;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\Player;
    use 
    pocketmine\event\player\PlayerItemConsumeEvent;
    use 
    pocketmine\entity\Effect;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\item\Item;

    class 
    Main extends PluginBase implements Listener{

        public function 
    onEnable(){
            
    $this->getLogger()->info("AmplifiedApples was enabled. Plugin by DiamondGamer30");
        }

        public function 
    onDisable(){
            
    $this->getLogger()->warning("AmplifiedApples were disabled!");
        }

        public function 
    onConsume(PlayerItemConsumeEvent $event){
            if(
    $event->getItem()->getId() === 466) {
                
    $player $event->getPlayer;

                
    $player->addEffect(Effect::getEffect(10)->setAmplifier(3)->setDuration(20)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(12)->setAmplifier(1)->setDuration(100)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(5)->setAmplifier(1)->setDuration(100)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(22)->setAmplifier(3)->setDuration(100)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(23)->setAmplifier(3)->setDuration(100)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(1)->setAmplifier(1)->setDuration(15)->setVisible(true));
                
    $player->addTitle("§5You have consumed a""§d§lGod Apple");
            }
            if(
    $event->getItem()->getId() === 322){
                
    $player $event->getPlayer;

                
    $player->addEffect(Effect::getEffect(10)->setAmplifier(2)->setDuration(10)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(12)->setAmplifier(1)->setDuration(10)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(5)->setAmplifier(1)->setDuration(10)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(22)->setAmplifier(3)->setDuration(10)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(23)->setAmplifier(3)->setDuration(10)->setVisible(true));
                
    $player->addEffect(Effect::getEffect(1)->setAmplifier(1)->setDuration(5)->setVisible(true));
                
    $player->addTitle("§5You have consumed a""§d§lGolden Apple");
            }
        }
    }
     
  5. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    LMFAO, im dumb
     
  6. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    Now this error ;-;

    29.10 15:36:06 [Server] Server thread/INFO Loading AmplifiedApples v1 29.10 15:36:06 [Server] Server thread/CRITICAL pocketmine\plugin\PluginException: "Couldn't load plugin AmplifiedApples: main class not found" (EXCEPTION) in "src/pocketmine/plugin/PharPluginLoader" at line 69
    29.10 15:36:06 [Server] Server thread/DEBUG #0 src/pocketmine/plugin/PluginManager(161): pocketmine\plugin\PharPluginLoader->loadPlugin(string phar:///plugins/AmplifiedApples_v1 (1).phar)
    29.10 15:36:06 [Server] Server thread/DEBUG #1 src/pocketmine/plugin/PluginManager(334): pocketmine\plugin\PluginManager->loadPlugin(string /plugins/AmplifiedApples_v1 (1).phar, array Array())
    29.10 15:36:06 [Server] Server thread/DEBUG #2 src/pocketmine/Server(1616): pocketmine\plugin\PluginManager->loadPlugins(string /plugins/) 29.10 15:36:06 [Server] Server thread/DEBUG #3 src/pocketmine/PocketMine(553): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string phar:///pmmp_65_1.2.phar/, string /, string /plugins/) 29.10 15:36:06 [Server] Server thread/DEBUG #4 /pmmp_65_1.2.phar(1): require(string phar:///pmmp_65_1.2.phar/src/pocketmine/PocketMine.php)
    29.10 15:36:06 [Server] Server thread/CRITICAL Could not load plugin 'AmplifiedApples
     
  7. iiFlamiinBlaze

    iiFlamiinBlaze Witch

    Messages:
    59
    GitHub:
    iiflamiinblaze
    remove \Main in the namespace.
     
  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.