Hi, It would be amazing! If someone makes CustomUI plugins and uploads them for free. Like shops and etc. Ill pay people to do it if needed.
I hope that it`s work. I not use customui. PHP: private $playerCurrentAction = [];private $actions = [];private $shop = [];public function init(){//You must use this method in onEnable or onLoad $this->actions = [ 'main' => [$this, 'getMainForm'], 'shop' => [$this, 'getShopForm'], 'pvp' => function(){return null;} ]; $this->shop = [[Item::BEDROK . ":0" => 100000000], [Item::STONE . ":0" => 1000000000000]];//[ID:damage => price]}public function addMenu(Player $player, string $action = 'main', ...$args): bool{ //Use it method where you need if(isset($this->actions[$action])){ $this->playerCurrentAction[strtolower($player->getName())] = $action; $form = call_user_func($this->actions, $player, ...$args); if($form === null){ return true; } $packet = new ShowModalFormPacket; $packet->formId = array_search($action, array_keys($this->action));//This must be number of your action $packet->data = json_encode($form, JSON_PRETTY_PRINT | JSON_BIGINT_AS_STRING); $player->dataPacket($packet); return true; } return false;}public function getMainForm(Player $player){ $form = ['type' => 'custom_form', 'title' => 'Welcome to menu, §c' . $player->getName() . '§r!', 'content' => []]; $firstElement = ['type' => 'label', 'text' => 'Choose an action! Available actions: shop, pvp']; $secondElement = ['type' => 'input', 'text' => 'Action: ', 'placeholder' => 'you must write action here!', 'default' => '']; $form['content']= [$firstElement, $secondElement]; return $form;}public function getShopForm(Player $player){ $items = []; foreach($this->shop as $data){ foreach($data as $item => $price){ $items[] = ['text' => (Item::get(...explode(":", $item)))->getName() . '. It`s cost $' . $price];//You can use EcnonomyAPI for checking player money and if player not enough money you can either change price color or not show item in form. } } return ['type' => 'custom_form', 'title' => 'It`s our shop! You can buy items here!', 'content' => '', 'buttons' => $items];}public function handlePacket(DataPacketReceiveEvent $event){ if(($packet = $event->getPacket()) instanceof ModalFormResponsePacket){ $player = $event->getPlayer(); $data = $packet->data; switch($packet->formId){ case array_search('main', array_keys($this->actions)): if($this->addMenu($player, $data)){ break; } $player->sendMessage('Sorry, but this action not available.'); break; case array_search('shop', array_keys($this->actions)): $price = array_values($this->shop[$data])[0]; $item = Item::get(...explode(":", array_keys($this->shop[$data])[0]); //TODO break; case array_search('pvp', array_search($this->actions)): $player->teleport(new Vector3(1, 1, 1)); break; } }}