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

Where is my mistake ?

Discussion in 'Plugin Help' started by TheWalkingDrift, Jun 23, 2019.

  1. TheWalkingDrift

    TheWalkingDrift Silverfish

    Messages:
    23
    This is the Problem:

    [14:16:43] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected ' ' (T_STRING), expecting '{'" (EXCEPTION) in "plugins/teleporter/src/fixed/Main" at line 16

    And this is my Code:

    <?php

    namespace Server;

    use pocketmine\plugin\PluginBase;
    use pocketmine\event\Listener;
    use pocketmine\command\CommandSender;
    use pocketmine\command\Command;
    use pocketmine\Player;
    use pocketmine\plugin\Plugin;
    use jojoe77777\FormAPI\SimpleForm;

    class Main extends Listener{

    public function openHelpUI(){
    $form = new SimpleForm(function(Player $player, int $data = null) {});
    $form->addbutton("§3Citybuild");
    }
    }

    public function onCommand(CommandSender $sender, string $commandLabel, array $args) {
    switch ($args[0]) {
    case "tpuicity":
    $this->openHelpUI($sender, "Menu Opened");
    }
    }
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Your bracket's didn't match up, here I fixed it:
    PHP:
    <?php

    namespace Server;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\Player;
    use 
    pocketmine\plugin\Plugin;
    use 
    jojoe77777\FormAPI\SimpleForm;

    class 
    Main extends Listener {
      public function 
    openHelpUI(){
        
    $form = new SimpleForm(function(Player $playerint $data null) {}); 
        
    $form->addbutton("§3Citybuild");
      }

      public function 
    onCommand(CommandSender $senderstring $commandLabel, array $args) {
        switch (
    $args[0]) {
          case 
    "tpuicity":
          
    $this->openHelpUI($sender"Menu Opened");
        }
      }
    }
    Please indent your code in the future and use an IDE to prevent errors like that
     
  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.