Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace your\name\space;
- use pocketmine\form\Form;
- use pocketmine\Player;
- class ExampleForm implements Form
- {
- public function jsonSerialize(): array
- {
- return [
- "type" => "form",
- "title" => "タイトル",
- "content" => "コンテンツ1\nコンテンツ2",
- "buttons" => [
- [
- "text" => "ボタン1",
- ],
- [
- "text" => "ボタン2",
- ],
- [
- "text" => "ボタン3",
- ],
- [
- "text" => "ボタン4",
- ],
- ],
- ];
- }
- public function handleResponse(Player $player, $data): void
- {
- if ($data === null) {
- return;
- }
- switch ($data) {
- case 0:
- //ボタン1
- break;
- case 1:
- //ボタン2
- break;
- case 2:
- //ボタン3
- break;
- case 3:
- //ボタン4
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement