All Projects → Yahir-AR → FormAPI-PMMP

Yahir-AR / FormAPI-PMMP

Licence: Apache-2.0 license
Create a Form for Minecraft Bedrock in PocketMine-MP

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to FormAPI-PMMP

Emotes
This plugin allows players to use their favorite emotes on the server!
Stars: ✭ 15 (+7.14%)
Mutual labels:  pocketmine, pocketmine-mp, pocketmine-plugin, pmmp-plugin
NpcDialog
🗽 PocketMine-MP virion to add dialogs to entities easily
Stars: ✭ 55 (+292.86%)
Mutual labels:  pocketmine, pocketmine-plugin, pmmp-plugin
PocketAI
Addon compatible AI plugin for PocketMine-MP
Stars: ✭ 25 (+78.57%)
Mutual labels:  pocketmine-mp, pocketmine-plugin, pmmp-plugin
BuilderTools
🪓 Powerful World Editor plugin for PocketMine servers
Stars: ✭ 74 (+428.57%)
Mutual labels:  pocketmine, pocketmine-mp, pocketmine-plugin
CosmeticMenu
Fun and Easy-to-Use Pocketmine Cosmetics plugin. (Gadgets, Particles, Trails, etc)
Stars: ✭ 22 (+57.14%)
Mutual labels:  pocketmine, pocketmine-mp, pmmp-plugin
ProperDuels
A properly made duels plugin
Stars: ✭ 16 (+14.29%)
Mutual labels:  pocketmine, pocketmine-mp, pocketmine-plugin
BlockSniper
An advanced (brush) world editing plugin for PocketMine-MP
Stars: ✭ 77 (+450%)
Mutual labels:  pocketmine, pocketmine-mp, pmmp-plugin
NativeDimensions
A plugin which loads dimensions within worlds and provides an API for managing dimensions across worlds
Stars: ✭ 16 (+14.29%)
Mutual labels:  pocketmine, pocketmine-mp
AuctionHouse
Feature-packed auction house plugin for PocketMine-MP (pmmp)
Stars: ✭ 31 (+121.43%)
Mutual labels:  pocketmine, pocketmine-mp
RedstoneCircuit
This is the PocketMine plugin that implements the Redstone circuit.
Stars: ✭ 81 (+478.57%)
Mutual labels:  pocketmine, pocketmine-mp
Pocketmine Mp
A server software for Minecraft: Bedrock Edition in PHP
Stars: ✭ 2,594 (+18428.57%)
Mutual labels:  pocketmine, pocketmine-mp
Pocketmine-School
A Website To Teach Everything About PocketMine-MP
Stars: ✭ 15 (+7.14%)
Mutual labels:  pocketmine, pocketmine-mp
ScoreboardAPI
A simple API for creating scoreboards on PocketMine-MP servers
Stars: ✭ 16 (+14.29%)
Mutual labels:  pocketmine, pocketmine-mp
BurgerCustomArmor
Create Custom Armor Sets with several abilities!
Stars: ✭ 25 (+78.57%)
Mutual labels:  pocketmine, pmmp-plugin
PocketMine-MP-Plugins
Repository full of goodies (all my awesome PocketMine-MP Plugins)
Stars: ✭ 33 (+135.71%)
Mutual labels:  pocketmine-plugin, pmmp-plugin
PerWorldInventory
A full-featured per world inventory plugin for PocketMine-MP.
Stars: ✭ 14 (+0%)
Mutual labels:  pocketmine-mp, pocketmine-plugin
Volt
A painless web server for PocketMine-MP
Stars: ✭ 24 (+71.43%)
Mutual labels:  pocketmine, pocketmine-mp
libform
It is a virion library that can handle various forms easily.
Stars: ✭ 12 (-14.29%)
Mutual labels:  pocketmine, pocketmine-mp
EggWars
EggWars minigame for PocketMine
Stars: ✭ 32 (+128.57%)
Mutual labels:  pocketmine, pocketmine-mp
Battles
Extremely extendable and customisable duels plugin designed for PocketMine-MP servers. 🚀 ⚔️
Stars: ✭ 13 (-7.14%)
Mutual labels:  pocketmine-plugin, pmmp-plugin

FormAPI-PMMP

Plugin to create easy forms for PocketMine-MP.
🎉 New update:

  • Now you can choose between getting the response via callback, or an event.
  • Now compatible with api 4.0.0

These new features are only available in the version compatible with api 4.0.0

Example Simple Form

For create a simple form

use FormAPI\window\SimpleWindowForm;
use FormAPI\elements\ButtonImage;
use FormAPI\elements\Button;
use pocketmine\player\Player;

$window = new SimpleWindowForm("name", "Select game", "Choose the game");//without callback
$window = new SimpleWindowForm("name", "Select game", "Choose the game", function (Player $player, Button $selected) {
    $player->sendMessage("Hello, you select " . $selected->getText());
});//with callback

$window->addButton("name", "SkyWars");//without image
$window->addButton("name1", "BedWars", new ButtonImage("path", "textures/items/bed_blue.png"));//with image
$window->showTo($player);


If your decision was not to use callback, you can get the response through this event
use FormAPI\response\PlayerWindowResponse;
use FormAPI\window\SimpleWindowForm;

public function onResponse(PlayerWindowResponse $event){
$player = $event->getPlayer();
$form = $event->getForm();

if(!$form instanceof SimpleWindowForm) return;
if($form->getName() !== "name") return;

if($form->isClosed()) {
$player->sendMessage("The form has been closed");
return;
}

$player->sendMessage($form->getClickedButton()->getText());
}

Example Modal Form

For create a modal form

use FormAPI\window\ModalWindowForm;
use pocketmine\player\Player;

$window = new ModalWindowForm("name", "A little question", "The plugin is good?", "Yes", "No, sorry");//without callback
$window = new ModalWindowForm("name", "A little question", "The plugin is good?", "Yes", "No, sorry", function (Player $player, bool $accept) {
    if ($accept) {
        $player->sendMessage("User accept");
    } else {
        $player->sendMessage("User cancel");
    }
});//with callback

$window->showTo($player);


If your decision was not to use callback, you can get the response through this event
use FormAPI\response\PlayerWindowResponse;
use FormAPI\window\ModalWindowForm;

public function onResponse(PlayerWindowResponse $event){
$player = $event->getPlayer();
$form = $event->getForm();

if(!$form instanceof ModalWindowForm) return;
if($form->getName() !== "name") return;

if($form->isClosed()) {
$player->sendMessage("The form has been closed");
return;
}

if($form->isAccept()) {//responsexD
$player->sendMessage("User accept");
} else {
$player->sendMessage("User cancel");
}
}

Example Custom Form

For create a custom form

use FormAPI\window\CustomWindowForm;
use pocketmine\player\Player;

$window = new CustomWindowForm("window_test", "Test", "This is a test");//without callback
$window = new CustomWindowForm("window_test", "Test", "This is a test", function (Player $player, CustomWindowForm $form) {
    $user = $form->getElement("users");
    $password = $form->getElement("password");

    $player->sendMessage($user->getName() . ": " . $user->getFinalValue());
    $player->sendMessage($password->getName() . ": " . $password->getFinalValue());
});//with callback

$window->addDropdown("users", "Select the users", ["ClembArcade", "RomnSD"]);
$window->addInput("password", "Insert your password");
$window->addSlider("age", "Select your age", 6, 20);
$window->addToggle("notifications", "You want receive notifications?");
$window->showTo($player);


If your decision was not to use callback, you can get the response through this event
use FormAPI\response\PlayerWindowResponse;
use FormAPI\window\CustomWindowForm;

public function onResponse(PlayerWindowResponse $event){
$player = $event->getPlayer();
$form = $event->getForm();

if(!$form instanceof CustomWindowForm) return;

if($form->getName() !== "window_test") return;

if($form->isClosed()) {
$player->sendMessage("The form has been closed");
return;
}

$user = $form->getElement("users");
$password = $form->getElement("password");
$age = $form->getElement("age");
$noti = $form->getElement("notifications");

$player->sendMessage($user->getName() . ": " . $user->getFinalValue());
$player->sendMessage($password->getName() . ": " . $password->getFinalValue());
$player->sendMessage($age->getName() . ": " . $age->getFinalValue());
$player->sendMessage($noti->getName() . ": " . $noti->getFinalValue());

}

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].