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

Please help me Error : Type Error

Discussion in 'Plugin Help' started by coldGRINGO, Sep 4, 2021.

  1. coldGRINGO

    coldGRINGO Spider

    Messages:
    9
    GitHub:
    coldgringo
    21:23

    > Server killed

    [00:21:31] [Server thread/INFO]: Loading pocketmine.yml...
    [00:21:31] [Server thread/INFO]: Loading server properties...

    [00:21:31] [Server thread/INFO]: Selected English (eng) as the base language

    [00:21:31] [Server thread/INFO]: Starting Minecraft: Bedrock Edition server
    version v1.17.10

    [00:21:31] [Server thread/INFO]: Online mode is enabled. The server will verify

    that players are authenticated to Xbox Live.

    [00:21:31] [Server thread/INFO]: Opening server on 0.0.0.0:19132
    [00:21:31] [Server thread/INFO]: This server is running PocketMine-MP version

    3.22.2

    [00:21:31] [Server thread/INFO]: PocketMine-MP is distributed under

    License

    [00:21:33] [Server thread/INFO]: Loading resource packs...

    the LGPL

    [00:21:33] [Server thread/INFO]: Loading Duels v1
    [00:21:33] [Server thread/CRITICAL]: TypeError: "Argument 1 passed to
    pocketmine\command\Command::setDescription() must be of the type string,

    array given, called in

    phar:///storage/emulated/0/Android/data/io.scer.pocketmine/files
    PHP:
    <?php

    namespace cold\DUELS;

    use 
    pocketmine\Server;
    use 
    pocketmine\Player;

    use 
    pocketmine\utils\Config;

    use 
    pocketmine\event\Listener;

    use 
    pocketmine\plugin\PluginBase;

    use 
    pocketmine\item\Item;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;

    use 
    pocketmine\event\block\BlockBreakEvent;
    use 
    pocketmine\event\block\BlockPlaceEvent;

    class 
    Main extends PluginBase implements Listener {
      public function 
    onEnable(){
        
    $this->getServer()->getPluginManager()->registerEvents($this$this);
        
    $this->setup = new Config($this->getDataFolder() . "setup.yml"Config::YAML, array());
        
    $this->players = new Config($this->getDataFolder() . "players.yml"Config::YAML, array());
      }

      public function 
    onCommand(CommandSender $senderCommand $cmdString $label, Array $args) : bool {
        
    $player $sender;
        
    $player_name $sender->getName();
        
    $player_orig $sender->getPlayer();
        if(isset(
    $args[0])){
          switch(
    strtolower($args[0])){
            case 
    "setup":
              case 
    "spawn":
                
    $level $player->getLevel()->getFolderName();
                
    $load $this->getServer()->loadLevel($level);
                if (
    $load) {
                  
    $player->sendMessage("§2Success §r: §aWorld was been loaded");
                  
    $player->teleport($this->getServer()->getLevelByName($level)->getSpawnLocation());
                  
    $this->setup->set("Level""$level");
                  
    $this->setup->save();
                  
    $player->sendMessage("§2Sucess §r: §aSaved the level");
                  
    $this->setup->set("Status_1""True");
                  
    $this->setup->save();
                }else{
                  
    $player->sendMessage("§4Error §r: §cWorld was not been loaded");
                }

                case 
    1:
                  
    $level $this->setup->get("Level");
                  
    $load $this->getServer()->loadLevel($level);

                  
    $x $player->getFloorX();
                  
    $y $player->getFloorY();
                  
    $z $player->getFloorZ();

                  
    $this->setup->set("X_1""$x");
                  
    $this->setup->set("Y_1""$y");
                  
    $this->setup->set("Z_1""$z");
                  
    $this->setup->save();

                  
    $player->sendMessage("§2Success §r: §aSpawn 1 was been saved");

                  
    $this->setup->set("Status_2""True");
                  
    $this->setup->save();

                break;

                case 
    2:
                  
    $level $this->setup->get("Level");
                  
    $load $this->getServer()->loadLevel($level);

                  
    $x $player->getFloorX();
                  
    $y $player->getFloorY();
                  
    $z $player->getFloorZ();

                  
    $this->setup->set("X_2""$x");
                  
    $this->setup->set("Y_2""$y");
                  
    $this->setup->set("Z_2""$z");
                  
    $this->setup->save();

                  
    $player->sendMessage("§2Success §r: §aSpawn 2 was been saved");

                  
    $this->setup->set("Status_3""True");
                  
    $this->setup->save();
                break;
              break;
            break;
            case 
    "join":
              
    $status_1 $this->setup->get("Status_1");
              
    $status_2 $this->setup->get("Status_2");
              
    $status_3 $this->setup->get("Status_3");

              if (
    $status_1 == "True" || $status_2 == "True" || $status_3 == "True") {
                
    $level $this->setup->get("Level");

                
    $x_1 $this->setup->get("X_1");
                
    $y_2 $this->setup->get("Y_2");
                
    $z_3 $this->setup->get("Z_3");

                
    $x_1 $this->setup->get("X_1");
                
    $y_2 $this->setup->get("Y_2");
                
    $z_3 $this->setup->get("Z_3");

                if (empty(
    $this->players->get("Count"))) {
                  
    $count += 1;
                  
    $this->players->set("Count""$count");
                  
    $this->players->save();
                }else{
                  
    $count $this->players->get("Count");
                  
    $this->players->set("Count""$count");
                  
    $this->players->save();
                }

                if (
    $this->players->get("Count") == 1) {
                  
    $this->players->set("Player_name_1""$player_name");
                  
    $this->players->set("Player_orig_1""$player_orig");
                  
    $this->players->save();
                }

                if (
    $this->players->get("Count") == 2) {
                  
    $this->players->set("Player_name_2""$player_name");
                  
    $this->players->set("Player_orig_2""$player_orig");
                  
    $this->players->save();
                }

                
    $count $this->players->get("count");

                if (
    $count == 2) {
                  
    $player_name_1 $this->players->get("Player_name_1");
                  
    $player_name_2 $this->players->get("Player_name_2");

                  
    $player_orig_1 $this->players->get("Player_orig_1");
                  
    $player_orig_2 $this->players->get("Player_orig_2");

                  
    $player_orig_1->teleport($this->getServer()->getLevelByName($this->setup->get("Level"))->getSpawnLocation());
                  
    $player_orig_1->teleport(new Vector3($this->setup->get("X_1"), $this->setup->get("Y_1"), $this->setup->get("Z_1")));

                  
    $player_orig_2->teleport($this->getServer()->getLevelByName($this->setup->get("Level"))->getSpawnLocation());
                  
    $player_orig_2->teleport(new Vector3($this->setup->get("X_2"), $this->setup->get("Y_2"), $this->setup->get("Z_2")));

                  
    $player_orig_1->sendMessage("§aGame Was Started");
                  
    $player_orig_2->sendMessage("§aGame Was Started");
                }
              }else{
                
    $player->sendMessage("§4Error §r: §cArena is not was enabled");
              }
              break;
          }
        }
      }
    }
     
  2. Pinesolz

    Pinesolz Spider

    Messages:
    8
    GitHub:
    atlzz
    PHP is case sensitive! Not sure if this helps since I'm unsure of the error, but try changing
    PHP:
    public function onCommand(CommandSender $senderCommand $cmdString $label, Array $args) : bool {
    to
    PHP:
    public function onCommand(CommandSender $senderCommand $cmdstring $label, array $args) : bool {
     
  3. coldGRINGO

    coldGRINGO Spider

    Messages:
    9
    GitHub:
    coldgringo
    Hi not solved

    error :

    [10:30:32] [Server thread/INFO]: Loading Duels v1
    [10:30:32] [Server thread/CRITICAL): ParseError: "syntax error, unexpected
    'public function onCommand' (T_STRING), expecting function (T_FUNCTION) or
    const (T_CONST)" (EXCEPTION) in "plugins/Duels.phar/src/cold/DUELS/Main"
    at line 28
    [10:30:32] [Server thread/CRITICAL): #0 pmsrc/vendor/pocketmine/
    classloader/src/BaseClassLoader(124): BaseClassLoader-
    >loadClass(string[15] cold\DUELS\Main)
    [10:30:32] [Server thread/CRITICAL): #1 (): BaseClassLoader->{closure}
    (string[15] cold\DUELS\Main)
    (10:30:32] [Server thread/CRITICAL): #2 (): spl_autoload_call(string[15]
    cold\DUELS\Main)
    [10:30:32] [Server thread/CRITICAL): #3 pmsrc/src/pocketmine/plugin/
    Plugin Manager(167): class_exists(string[15] cold\DUELS\Main, boolean 1)
    [10:30:32] [Server thread/CRITICAL): #4 pmsrc/src/pocketmine/plugin/
    Plugin Manager(346): pocketmine\plugin\PluginManager-
    >loadPlugin(string[90] /storage/emulated/0/Android/data/io.scer.pocketmine/
    files/PocketMine-MP/plugins/, array[2])
    [10:30:32] [Server thread/CRITICAL): #5 pmsrc/src/pocketmine/Server(1529):
    pocketmine\plugin\Plugin Manager->loadPlugins(string[80] /storage/emulated/
    0/Android/data/io.scer.pocketmine/files/PocketMine-MP/plugins/)
    [10:30:32] [Server thread/CRITICAL): #6 pmsrc/src/pocketmine/
    PocketMine(314): pocketmine\Server->__construct(object BaseClassLoader,
    object pocketmine\utils\MainLogger, string[72] /storage/emulated/0/Android/
    data/io.scer.pocketmine/files/PocketMine-MP/, string[80] /storage/emulated/
    0/Android/data/io.scer.pocketmine/files/PocketMine-MP/plugins/)
    [10:30:32] [Server thread/CRITICAL): #7 pmsrc/src/pocketmine/
    PocketMine(344): pocketmine\server()
    [10:30:32] [Server thread/CRITICAL): #8 pmsrc(11): require(string[127]
    phar:///storage/emulated/0/Android/data/io.scer.pocketmine/files
    /PocketMine-MP/P)
    [10:30:32] [Server thread/EMERGENCY]: An unrecoverable error has occurred
    and the server has crashed. Creating a crash dump
    [10:30:32] [Server thread/EMERGENCY]: Please upload the "/storage/emulated/
    0/Android/data/io.scer.pocketmine/files/PocketMine-MP/crashdumps/
    Mon_Sep_6-10.30.32-UTC_2021.log" file to the Crash Archive and submit the
    link to the Bug Reporting page. Give as much info as you can.
    --- Waiting 113 seconds to throttle automatic restart (you can kill the process
    safely now) --
     

    Attached Files:

  4. Pinesolz

    Pinesolz Spider

    Messages:
    8
    GitHub:
    atlzz
    Your code has some sort of unregonziable symbol... Change " " to a literal space... It looks similair to a bullet point on my laptop.
    Also, you may want to keep that file private so others don't claim your code as theirs. Next time send a screenshot or text block!

    upload_2021-9-6_19-41-54.png

    Above shows the symbol causing the error^^

     
  5. Pinesolz

    Pinesolz Spider

    Messages:
    8
    GitHub:
    atlzz
    For future references,

    "Expecting function (T_FUNCTION) or const (T_CONST)", usually tells you that the end of file or line of code is unexpected...
    (Say you're missing a "}")
     
  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.