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

FormAPI

Discussion in 'Plugin Help' started by HannesTheDev, Feb 9, 2021.

  1. HannesTheDev

    HannesTheDev Spider

    Messages:
    7
    GitHub:
    HannesTheDev
    Hello: In my Plugin only Test1 does Work. What can i do?

    $form = new CustomForm(function (Player $player, $data = null) {
    if ($data[2] !== null) {
    $spieler = $this->getServer()->getPlayerExact($data[2]);
    if ($spieler instanceof Player) {
    switch ($data[1]) {
    case "§6Test1":
    $this->checkTest($player, $spieler, "Test1");
    break;
    case "§2Test2":
    $this->checkTest($player, $spieler, "Test2");
    break;
    case "§aTest3":
    $this->checkTest($player, $spieler, "Test3");
    break;
    case "§5Test4":
    $this->checkTest($player, $spieler, "Test4");
    break;
    case "§cTest5":
    $this->checkTest($player, $spieler, "Test5");
    break;
    case "§r§lTest6":
    $this->checkTest($player, $spieler, "Test6");
    break;
    }
    } else {
    $player->sendMessage(Main::pREFIX . "§cDieser Spieler ist Offline oder exestiert nicht!");
    }
    } else {
    $player->sendMessage(Main::pREFIX . "§cVorgang abgebrochen...");
    }
    });
    $form->setTitle("§8-=§6§lTest§r§8=-");
    $form->addLabel("§7TestUI");
    $form->addDropdown("Wähle den Rang:", ["§6Test1", "§2Test2", "§aTest3", "§5Test4", "§cTest5", "§r§lTest6"]);
    $form->addInput("§7Spieler:");
    $form->sendToPlayer($player);
    return $form;
     
  2. ItsInspire

    ItsInspire Silverfish

    Messages:
    15
    GitHub:
    itsinspire
    Can you try
    PHP:
            $form = new CustomForm(function (Player $player$data null) {
                if (
    $data[2] !== null) {
                    
    $spieler $this->getServer()->getPlayerExact($data[2]);
                    if (
    $spieler instanceof Player) {
                        switch (
    $data[1]) {
                            case 
    0:
                                
    $this->checkTest($player$spieler"Test1");
                                break;
                            case 
    1:
                                
    $this->checkTest($player$spieler"Test2");
                                break;
                            case 
    2:
                                
    $this->checkTest($player$spieler"Test3");
                                break;
                            case 
    3:
                                
    $this->checkTest($player$spieler"Test4");
                                break;
                            case 
    4:
                                
    $this->checkTest($player$spieler"Test5");
                                break;
                            case 
    5:
                                
    $this->checkTest($player$spieler"Test6");
                                break;
                        }
                    } else {
                        
    $player->sendMessage(Main::pREFIX "§cDieser Spieler ist Offline oder exestiert nicht!");
                    }
                } else {
                    
    $player->sendMessage(Main::pREFIX "§cVorgang abgebrochen...");
                }
            });
            
    $form->setTitle("§8-=§6§lTest§r§8=-");
            
    $form->addLabel("§7TestUI");
            
    $form->addDropdown("Wähle den Rang:", ["§6Test1""§2Test2""§aTest3""§5Test4""§cTest5""§r§lTest6"]);
            
    $form->addInput("§7Spieler:");
            
    $form->sendToPlayer($player);
            return 
    $form;
     
  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.