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

I need help with my plugin!

Discussion in 'Plugin Help' started by PandaDev, Jan 30, 2020.

  1. PandaDev

    PandaDev Spider

    Messages:
    12
    GitHub:
    pandajesus123
    Ok so im new to coding and tbh i don't know exactly what im doing but i can make i am atleast able to make a plugin. Anyways i made a test plugin because I wanted to make a kit plugin and when i load the plugin into the pocketmine app is says this (
    [02:57:04] [Server thread/INFO]: Loading kit v1
    [02:57:04] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected 'use' (T_USE), expecting '{'" (EXCEPTION) in "plugins/Kits/src/PandaDev/kit/Main" at line 5) so i need help how to fix this
     
  2. PandaDev

    PandaDev Spider

    Messages:
    12
    GitHub:
    pandajesus123
    Also here is the code in the main.php
    <?php

    namespace PandaDev\kit

    use pocketmine\Server
    use pocketmine\plugin\PluginBase;
    use pocketmine\command\CommandSender;
    use pocketmine\{Player, Server};
    use pocketmine\command\command;
    use jojoe77777\FormAPI;

    class Main extends PluginBase{

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

    public function onCommand(CommandSender $o, Command $kmt, string $label, array $args): bool{
    if($kmt->getName() == "kit"){
    $this->videoForm($o);
    }
    return true;
    }

    public function videoForm(player $o){
    $f = $this->getServer()getPluginManager()->getPlugin("FormAPI")->createSimpleForm(function (Player $o, aray $data){
    $re = $data[0];
    if($re === null){
    return true;
    }
    switch($re){
    case 0:
    $o->sendMessage("idk");
    break;
    }
    });

    $f->setTitle("kits");
    $f->setContent("choose a kit");
    $f->addButton("kit 1");
    $f->sendToPlayer($o);
    }
    }
    ?>
     
  3. TobiasDev

    TobiasDev Spider

    Messages:
    13
    GitHub:
    tobiasg-de
    You are missing a ; after "use pocketmine\Server".
    Oh, and you are missing a ; too in the line where you print "Enabled" to the console
     
  4. amirTBM

    amirTBM Spider Jockey

    Messages:
    27
    GitHub:
    we
    you have to put a ; after namespace
     
  5. PandaDev

    PandaDev Spider

    Messages:
    12
    GitHub:
    pandajesus123
    Thank you but it says this in the console

    [17:26:41] [Server thread/INFO]: Loading kit v1
    [17:26:41] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected '}'" (EXCEPTION) in "plugins/Kits/src/PandaDev/kit/Main" at line 16
     
  6. Invy55

    Invy55 Witch

    Messages:
    52
    GitHub:
    invy55
    Please use php tag in the forum.
    Your error is there:
    PHP:
    public function onEnable(){
    $this->getLogger()->info("Enabled!"//HERE
    }
    You forgot to put the ; at the end of the line as also @TobiasDev said. Please learn php and error debugging .-.
     
  7. amirTBM

    amirTBM Spider Jockey

    Messages:
    27
    GitHub:
    we
    you forget ; again in line 15 :/
     
  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.