SimpleForm
[virion] It Implements Simple Using Form Library System
How To Use
- First, declare the use statement.
use AidenKR\SimpleForm\SimpleForm;
use AidenKR\SimpleForm\SimpleFormHandler;
- Declare the function in the second
onEnable()
SimpleFormHandler::register($this);
- Create Modal Form
$api = SimpleForm::getInstance();
$form = $api->CustomForm(function (Player $player, $result) {
if(!isset($result)) return;
if($result === true) {
$player->sendMessage("This Is Modal Form Button 1");
}
if($result === false) {
$player->sendMessage("This IS Modal Form Button 2");
}
});
$form->setTitle("Modal Example Form Title");
$form->setTitle("Modal Example Form Content");
$form->setButton1("Modal Form Button 1");
$form->setButton2("Modal Form Button 2");
$form->sendToForm($player);
- Create Button Form
$api = SimpleForm::getInstance();
$form = $api->ButtonForm(function (Player $player, $result) {
if (!isset($result)) return;
if($result == 0) {
$player->sendMessage("This Is Button");
}
if($result == 1) {
$player->sendMessage("This Is Image Button");
}
});
$form->setTitle("Button Example Form Title");
$form->addButton("Button");
$form->addButton("Image Button", "/resources/items/Paper.png");
$form->sendToForm($player);
- Create Custom Form
$api = SimpleForm::getInstance();
$form = $api->CustomForm(function (Player $player, $result) {
if (!isset($result)) return;
});
$form->setTitle("Custom Example Form Title");
$form->addDropdown("This Is Dropdown", ["d", "r", "o", "p", "d", "o", "w", "n"]);
$form->addInput("This Is Input", "This Type Is Input");
$form->addLabel("Hello It Type Is Label");
$form->addSlider("This Is Slider", 1, 10);
$form->addStepSlider("This Is StepSlider", []);
$form->addToggle("This Is Toggle");
$form->sendToForm($player);