Created
May 14, 2020 05:45
-
-
Save PJZ9n/70821cc3fa55684abb5a71a19656ca90 to your computer and use it in GitHub Desktop.
pocketmine\form\Formを無名クラスで使う
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace Author\PluginName; | |
use pocketmine\command\Command; | |
use pocketmine\command\CommandSender; | |
use pocketmine\form\Form; | |
use pocketmine\Player; | |
use pocketmine\plugin\PluginBase; | |
use pocketmine\utils\TextFormat; | |
class Main extends PluginBase | |
{ | |
public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool | |
{ | |
if (!$sender instanceof Player) { | |
$sender->sendMessage(TextFormat::RED . "プレイヤーから実行してください!"); | |
return true; | |
} | |
$form = new class implements Form { | |
public function handleResponse(Player $player, $data): void | |
{ | |
// TODO: Implement handleResponse() method. | |
} | |
public function jsonSerialize() | |
{ | |
// TODO: Implement jsonSerialize() method. | |
} | |
}; | |
$sender->sendForm($form); | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment