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

Effect Remove Help

Comments in 'Plugin Development' started by SM11, Aug 18, 2015.

  1. Rspuds
    Offline

    Rspuds New Member

    Joined:
    Aug 4, 2015
    Posts:
    53
    Same or new error?
  2. SM11
    Offline

    SM11 Active Member

    Joined:
    Jun 21, 2015
    Posts:
    117
    Minecraft User:
    SM11
    An unknown error occurred while attempting to perform this command

    08:41:44[CRITICAL] Unhandled exception executing command 'er world speed' in Er: Argument 1 passed to SM11\EffectRemove\Main::removeEffectFromWorld() must be an instance of pocketmine\level\Level, string given, called in C:\Users\shawn_000\Desktop\MCPE Test Pocketmine\PocketMine-MPTest\plugins\EffectRemove\src\SM11\EffectRemove\Main.php on line 25 and defined

    08:41:44[NOTICE] InvalidArgumentException: "Argument 1 passed to SM11\EffectRemove\Main::removeEffectFromWorld() must be an instance of pocketmine\level\Level, string given, called in C:\Users\shawn_000\Desktop\MCPE Test Pocketmine\PocketMine-MPTest\plugins\EffectRemove\src\SM11\EffectRemove\Main.php on line 25 and defined" (E_RECOVERABLE_ERROR) in "/EffectRemove/src/SM11/EffectRemove/Main" at line 28
  3. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Learn PHP. Period. You don't even know PHP, and you're trying to make a plugin.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    As if you do.
  5. SM11
    Offline

    SM11 Active Member

    Joined:
    Jun 21, 2015
    Posts:
    117
    Minecraft User:
    SM11
    lol That was the wrong code I made, I fixed it stop, showing me old stuff,
  6. SM11
    Offline

    SM11 Active Member

    Joined:
    Jun 21, 2015
    Posts:
    117
    Minecraft User:
    SM11
    This is Code
    PHP:
    <?php

    namespace SM11\EffectRemove;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\effect\Effect;
    use 
    pocketmine\level\Level;

    class 
    Main extends PluginBase{

        public function 
    onEnable(){
            
    $this->getLogger()->info("EffectRemove have been Enabled!");
        }

        public function 
    onDisable(){
            
    $this->getLogger()->info("EffectRemove Have been Enabled!");
        }

       public function 
    onCommand(CommandSender $sender,Command $cmd,$label, array $args) {
         if (
    $cmd->getName() != "Er") return false;
         if(
    count($args) != 2) return false;
             
    $this->getServer()->getLevelByName($args[0]);
             
    $this->removeEffectFromWorld($args[0], $args[1]);
            
    }
       public function 
    removeEffectFromWorld(Level $world$effectId){
             
    $effectName Effect::getEffect($effectId)->getName();
             foreach(
    $world->getPlayers() as $p){
             if(
    $p->hasEffect($effectId)){
             
    $p->removeEffect($effectId);
             
    $p->sendPopup('[SSM] '.$effectName.'May The Match Begin');
             }
             }
             
    $this->getServer()->SendPopup('[SSM] '.ucfirst($effectName).' Match Has started'.$world->getName().' world');
             return 
    true;
    }

       }
  7. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    I wasn't on for a few days, and that was the first post I saw. :p
  8. SM11
    Offline

    SM11 Active Member

    Joined:
    Jun 21, 2015
    Posts:
    117
    Minecraft User:
    SM11
    Then Think before you write Something
  9. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    :p
  10. SM11
    Offline

    SM11 Active Member

    Joined:
    Jun 21, 2015
    Posts:
    117
    Minecraft User:
    SM11
    Why Doesn't this work, ugh why.
  11. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    That's why I told you to learn PHP, so you can find your mistakes. :p
  12. SM11
    Offline

    SM11 Active Member

    Joined:
    Jun 21, 2015
    Posts:
    117
    Minecraft User:
    SM11
    The Fact that I've learned PHP is the reason why I'm Making Plugins, I've actually Submitted a Plugin to the Plugins Section
  13. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    So did the plugin get accepted?
  14. SM11
    Offline

    SM11 Active Member

    Joined:
    Jun 21, 2015
    Posts:
    117
    Minecraft User:
    SM11
    idk yet, I submitted It on Monday
  15. SM11
    Offline

    SM11 Active Member

    Joined:
    Jun 21, 2015
    Posts:
    117
    Minecraft User:
    SM11
    How long does it take to get a Plugin Approved anyways?
  16. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It's still wrong. $args is a string array, and the function accepts a Level parameter.

Share This Page

Advertisement