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

explode() expects parameter 2 to be string, boolean given. Wait what?

Discussion in 'Facepalm' started by NickTehUnicorn, Jul 20, 2017.

  1. NickTehUnicorn

    NickTehUnicorn Zombie

    Messages:
    200
    GitHub:
    unickorn
    It hasn't been a week since I started learning about plugin coding so #DontJudge #ImOnly12 #RespectNewbies

    This server is running PocketMine-MP 1.6.2dev+poggit.1197 「Unleashed」 implementing API version 3.0.0-ALPHA6 for Minecraft: PE v1.1.0.55 (protocol version 113)

    I got a "plugin skeleton" as DevTools says, by doing /genplugin Hey Hey
    After that, I edited the code to give me "Heyyyyyyyyy!" when I run the command /hey by this:
    PHP:
    <?php

    namespace Hey\Hey;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\Command;

    class 
    Main extends PluginBase{

        public function 
    onEnable(){
            
    $this->getLogger()->info("Hey enabled!");
        }

        public function 
    onCommand(CommandSender $senderCommand $command$label, array $args){
            switch(
    $command->getName()){
                case 
    "hey":
                    
    $sender->sendMessage("Heyyyyyyyyyyy!");
                    return 
    true;
                default:
                    return 
    false;
            }
        }

        public function 
    onDisable(){
            
    $this->getLogger()->info("Byeeeee");
        }
    }
    And it gave me this:
    [22:01:10] [Server thread/CRITICAL]: Unhandled exception executing command 'hey' in hey: explode()
    expects parameter 2 to be string, boolean given

    [22:01:10] [Server thread/CRITICAL]: TypeError: "explode() expects parameter 2 to be string, boolean given" (EXCEPTION) in "src/pocketmine/command/Command" at line 189


    What have I done wrong? (or have I?)
     
    Last edited: Jul 20, 2017
  2. NickTehUnicorn

    NickTehUnicorn Zombie

    Messages:
    200
    GitHub:
    unickorn
    Wow. I can't even do /help anymore.
    [22:24:29] [Server thread/CRITICAL]: Unhandled exception executing command 'help' in help: explode() expects parameter 2 to be string, boolean given
    [22:24:29] [Server thread/CRITICAL]: TypeError: "explode() expects parameter 2 to be string, boolean given" (EXCEPTION) in "src/pocketmine/command/Command" at line 189
     
  3. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    add break; before return true;
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    No, just no


    Can I see your plugin.yml?
     
  5. NickTehUnicorn

    NickTehUnicorn Zombie

    Messages:
    200
    GitHub:
    unickorn
    I think the problem was with the PocketMine-MP.phar.
    It started working after getting a newer one. (And adding the new api 3.0.0-ALPHA7 changes to the plugin)
     
  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.