Hey im new to pocketmine plugin development and i need help im making a plugin where you right click and it opens a form like a server selector but it when i make the code nothing happens! PHP: <?phpnamespace besher\test;use pocketmine\Server;use pocketmine\Player;use pocketmine\plugin\PluginBase;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\utils\TextFormat;use jojoe77777\FormAPI;use pocketmine\event\Listener;use pocketmine\event\player\PlayerInteractEvent;use pocketmine\item\Item;class main extends PluginBase implements Listener {public function onEnable(){$this->getServer()->getPluginManager()->registerEvents($this, $this);}public function onCommand(CommandSender $sender, Command $cmd, String $label, Array $args) : bool{switch($cmd->getName()){case "core":if($sender instanceof Player){$this->cosform($sender);} else {$sender->sendMessage("You cant open a ui when you are console");}}return true;}public function cosForm($player){$api = $this->getServer()->getPluginManager()->getPlugin("FormAPI");$form = $api->createSimpleForm(function (Player $player, int $data = null){$result = $data;if($result === null){return true;}switch($result){case 0:$this->openSizeForm($player);break;case 1:$this->openFlyForm($player);break;}});$form->setTitle("Cosmetics");$form->setContent("Cosmetics");$form->addButton("Size");$form->addButton("Fly");$form->sendToPlayer($player);return $form;}public function openFlyForm($player){$api = $this->getServer()->getPluginManager()->getPlugin("FormAPI");$form = $api->createSimpleForm(function (Player $player, int $data = null){$result = $data;if($result === null){return true;}switch($result){case 0:$player->setAllowFlight("true");break;case 1:$player->setAllowFlight("false");break;case 2:$this->cosForm($player);break;}});$form->setTitle("Fly");$form->setContent("Enable or Disable Flight");$form->addButton("Enable Flight");$form->addButton("Disable Flight");$form->sendToPlayer($player);return $form;}public function openSizeForm($player){$api = $this->getServer()->getPluginManager()->getPlugin("FormAPI");$form = $api->createSimpleForm(function (Player $player, int $data = null){$result = $data;if($result === null){return true;}switch($result){case 0:$player->setScale("5");break;case 1:$player->setScale("3");break;case 2:$player->setScale("1");break;case 3:$this->cosForm($player);break;}});$form->setTitle("Size");$form->setContent("Choose a SIZE");$form->addButton("Large");$form->addButton("Medium");$form->addButton("Normal");$form->addButton("Back");$form->sendToPlayer($player);return $form;}public function NaviForm($player){$api = $this->getServer()->getPluginManager()->getPlugin("FormAPI");$form = $api->createSimpleForm(function (Player $player, int $data = null){$result = $data;if($result === null){return true;}switch($result){case 0:$command = "sw random";$this->getServer()->getCommandMap()->dispatch($player, $command);break;case 1:$command = "is go";$this->getServer()->getCommandMap()->dispatch($player, $command);break;case 2:$player->sendMessage("BedWars is currently under construction");break;case 3:$player->sendMessage("TheBridge is currently under construction");break;}});$form->setTitle("§4§6NAVIGATOR");$form->setContent("§lChoose a MINIGAME you would like to PLAY");$form->addButton("§6§lSkyWars");$form->addButton("§l§7SKY§l§aBLOCK");$form->addButton("§l§4BED§f§lWars");$form->addButton("§l§cTHEB§l§9RIDGE");$form->sendToPlayer($player);return $form;}public function onInteract(PlayerInteractEvent $event){$player = $event->getPlayer();$item = Item::get(2, 0, 0); //2 is grass block, you can change it to what ever you wantif ($player->getInventory()->getItemInHand()->getId() === $item) {$this->cosForm($player);$player->sendMessage("Opening Server UI...");}}}
why you dont learn php? nobody can't make plugin for you brother, learn php i make your plugin but im bussy i can't code for you link: http://s10.picofile.com/file/8406550734/pleasework.rar.html
yeah im trying but i dont know where to start like what website can u recomend any and how did you learn
He's not looking for commands. He's looking for an "item" that "executes" command or opens a function
Okay found some more issues. Change class main to class Main. Second, why the hell did you write PHP: case "core": if($sender instanceof Player){ $this->cosform($sender); When you wrote PHP: public function cosForm($player){ ??? The name of the function has to match "cosform" I've fixed these errors and it works. Try doing it yourself since you said you wanted to learn. If you still don't get it, I'll send you a new code.