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

How do I use FormAPI?

Discussion in 'Development' started by DiamondGamer30, Oct 16, 2017.

  1. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    Correct Code
    PHP:
    if($command->getName() == "infoui") {
    if(!
    $sender instanceof Player){
    $sender->sendMessage("§cThis works only in-game");
    return 
    true;
    }
    if(
    $this->getConfig()->get("enabled") === false){
    $sender->sendMessage("§cThis feature is disabled");
    return 
    true;
    }
    $form $this->getServer()->getPluginManager()->getPlugin("FormAPI")->createSimpleForm(function (Player $sender,  $data) {
    switch(
    $data) {
    case 
    0:
    $sender->sendMessage("Working!");
    break;
    }
    });
    $form->setTitle("Server Info");
    $form->setContent($this->getConfig()->get("text"));
    $form->addButton("OK!");
    $form->sendToPlayer($sender);
    }
     
  2. David Flash

    David Flash Spider Jockey

    Messages:
    26
    GitHub:
    davidflashcz
    Yes it works, thank you! :)
     
  3. David Flash

    David Flash Spider Jockey

    Messages:
    26
    GitHub:
    davidflashcz
    Btw, what was the problem?
     
  4. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    you can see source, but befor please learn PHP (in you dont know ;) ) also you can add files in to your own plugin or depend it in your plugin.
     
  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.