EasyForm Help

Discussion in 'Development' started by ZackyVN, Mar 5, 2019.

  1. ZackyVN

    ZackyVN Baby Zombie

    Messages:
    131
    Hi, here is my code
    PHP:
    <?php

    declare(strict_types=1);

    namespace 
    MrDinoDuck\AdvancedWings;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\Player;
    use 
    jojoe77777\FormAPI\{CustomFormSimpleForm};
    use 
    MrDinoDuck\AdvancedWings\Forms\WingMenu;
    use 
    MrDinoDuck\AdvancedWings\Tasks\ParticlesTask;
    use 
    MrDinoDuck\AdvancedWings\Forms\{WingUICircleUIWalkingUI};
    use 
    Frago9876543210\EasyForms\elements\Button;
    use 
    Frago9876543210\EasyForms\forms\MenuForm;

    class 
    Main extends PluginBase{
       
        public 
    $wing = [];
        public 
    $circle = [];
        public 
    $walking = [];

        public function 
    onCommand(CommandSender $senderCommand $commandstring $label, array $args) : bool{
            switch(
    $command->getName()){
                case 
    "wings":
                
    $sender->sendForm(new MenuForm("§a[§b§lWings§r§a]""§9•§e Chọn loại hình", [
        new 
    Button("Wing"),
        new 
    Button("Circle"),
        new 
    Button("Walking")]),
        function(
    Player $playerButton $selected) : void{
            if(
    $response->getText() === "Wing"){
                
    $wing = new WingUI($this);
                
    $player->sendForm($wing);
            }elseif(
    $response->getText() === "Circle"){
                
    $circle = new CircleUI($this);
                
    $player->sendForm($circle);
            }elseif(
    $response->getText() === "Walking"){
                
    $walking = new WalkingUI($this);
                
    $player->sendForm($walking);
            }
        }
    );
            return 
    true;
        }
    }
    }
    When i clicked on the button, it do nothing. No Console Error. Please help
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,525
    GitHub:
    muqsit
    Here's a trick to debug such errors.
    Print the value in the console.
    PHP:
    var_dump($response->getText());
    Does it meet any of your if cases? Or if nothing gets outputted in the console, then consider that part of the code is not executing.
     
  3. wolfdale

    wolfdale Zombie

    Messages:
    300
    Are you sure there were no errors? It seems to me that $response is not defined
     
  4. ZackyVN

    ZackyVN Baby Zombie

    Messages:
    131
    i changed that but it still didnt do anythings
     
  5. akmalrizki

    akmalrizki Spider

    Messages:
    8
    GitHub:
    Beaconcraft
    I need a code UI button that can connect with other UI commands
     

Share This Page

  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.