We recommend that you use the following plugins instead.
https://github.com/refteams/libNpcDialogue
https://github.com/andresbytes/NpcDialog
https://github.com/ScarceityPvP/NpcForm
https://github.com/ohYanoox/DialogueUIAPI
use pocketmine\Player;
use npc\entity\npc;
use npc\chat\SimpleChat;
//$player = $event->getPlayer();
//$level = $player->getLevel();
//$pos = $player->asVector3();
$chat = new SimpleChat(function(Player $player, ?int $response){
if($response === null){
$player->sendMessage("canceled");
return;
}
$player->sendMessage((String) $response);
});
$chat->setTitle("title");
$chat->setContents("contents");
$chat->addButton("button0");
$chat->addButton("button1");
$chat->addButton("button2");
$chat->addButton("button3");
$chat->addButton("button4");
$chat->addButton("button5");
$entity = npc::create($pos, $level, $chat);//NPC Entity Spawn