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

Solved works as folder plugin but not phar

Comments in 'Plugin Development' started by Rspuds, Aug 11, 2015.

  1. Rspuds
    Offline

    Rspuds New Member

    Joined:
    Aug 4, 2015
    Posts:
    53
    I made this plugin and it works fine in folder form using dev tools but when I make it into a phar file using dev tools it doesn't work. I posted this with an another plugin and did really get an answer. So I really want to know why this is because making plugins then not being able to make them info phar files really sucks.

    Here is both my plugin.yml and main.php which are the only two files in this plugin

    PHP:
    <?php

    namespace LuckyBlocksEffects;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\entity\Effect;
    use 
    pocketmine\Server;
    use 
    pocketmine\Player;
    use 
    pocketmine\event\Event;
    use 
    pocketmine\event\block;
    use 
    pocketmine\event\block\BlockBreakEvent;
    use 
    pocketmine\event\Listener;

    class 
    Main extends PluginBase implements Listener{
       
        public function 
    onEnable() {
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
            
    $this->getLogger()->info(TextFormat::GREEN."LuckyBlocksEffects enabled");
        }
       
        public function 
    onDisable() {
            
    $this->getLogger()->info(TextFormat::RED."LuckyBlocksEffects disabled");
        }
       
        public function 
    onBlockBreak(BlockBreakEvent $event){
            
    $block $event->getBlock();
            
    $blockID $block->getId();
            
    $player $event->getPlayer();
            if(
    $blockID === 121){
            if(
    $player instanceof Player){
                
    $this->getReward($player);
                }
            }
        }
       
        public function 
    getReward($player){
            
    $randNum rand(116);
            switch (
    $randNum){
                case 
    1:
                    
    $effectID 1;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    2:
                    
    $effectID 2;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    3:
                    
    $effectID 3;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    4:
                    
    $effectID 4;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    5:
                    
    $effectID 5;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    6:
                    
    $effectID 8;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    7:
                    
    $effectID 9;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    8:
                    
    $effectID 10;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    9:
                    
    $effectID 11;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    10:
                    
    $effectID 12;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    11:
                    
    $effectID 13;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    12:
                    
    $effectID 14;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    13:
                    
    $effectID 18;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    14:
                    
    $effectID 19;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    15:
                    
    $effectID 20;
                    
    $this->rewardEffect($player$effectID);
                    break;
                case 
    16:
                    
    $effectID 21;
                    
    $this->rewardEffect($player$effectID);
                    break;
        }
    }   
        public function 
    rewardEffect($player $effectID){
            if(
    $player instanceof Player){
                
    $effect Effect::getEffect($effectID);
                
    $effect->setDuration(rand(1060)*20);
                
    $effect->setAmplifier(rand(04));
                
    $effect->setVisible(true);
                
    $player->addEffect($effect);
                if (
    rand(110)=5){
                    
    $randNum rand(116);
                    
    $this->getReward($player);
               
                }
            }
        }
    }
    Code:
    name: LuckyBlocksEffects
    version: 0.1
    main: LuckyBlocksEffects\Main
    api: [1.12.0]
    
    load: STARTUP
    author: Rspuds
    description: like lucky blocks but with effects
  2. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    Did you drag the phar into the plugins folder, from DevTools folder?
  3. Rspuds
    Offline

    Rspuds New Member

    Joined:
    Aug 4, 2015
    Posts:
    53
    yes, wish it was as simple as that
  4. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    What messages are in the console?
  5. Rspuds
    Offline

    Rspuds New Member

    Joined:
    Aug 4, 2015
    Posts:
    53
    there was no message in console. It didn't even recognize the plugin leading me to thing its the plugin.yml but it looks fine to me.
  6. Rspuds
    Offline

    Rspuds New Member

    Joined:
    Aug 4, 2015
    Posts:
    53
    wow... figured it out. My plugin.yml was named with a capital "P". well at least it works now
    jojoe77777 likes this.

Share This Page

Advertisement