diff --git a/composer.json b/composer.json index d338533..7e097e6 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,6 @@ "type": "library", "require": { "php": "^8.1", - "dktapps/pmforms": "dev-master", "sof3/await-generator": "^3.6", "pocketmine/pocketmine-mp": "^5.0" }, diff --git a/composer.lock b/composer.lock index e6a3cfc..8e32c52 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "03b96cbceedb504ba98370e14aa99338", + "content-hash": "03353ce48c066607f982b5f6db9cd3ed", "packages": [ { "name": "adhocore/json-comment", @@ -120,52 +120,6 @@ ], "time": "2023-01-15T23:15:59+00:00" }, - { - "name": "dktapps/pmforms", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/dktapps-pm-pl/pmforms.git", - "reference": "ea46df4e4c73675010fa860be5db6fbda60a85d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dktapps-pm-pl/pmforms/zipball/ea46df4e4c73675010fa860be5db6fbda60a85d4", - "reference": "ea46df4e4c73675010fa860be5db6fbda60a85d4", - "shasum": "" - }, - "require": { - "pocketmine/pocketmine-mp": "^4.0.0 || ^5.0.0" - }, - "require-dev": { - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.2.0", - "phpstan/phpstan-strict-rules": "^1.0" - }, - "default-branch": true, - "type": "library", - "extra": { - "virion": { - "spec": "3.0", - "namespace-root": "dktapps\\pmforms" - } - }, - "autoload": { - "psr-4": { - "": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0" - ], - "description": "Form API library for PocketMine-MP plugins", - "support": { - "issues": "https://github.com/dktapps-pm-pl/pmforms/issues", - "source": "https://github.com/dktapps-pm-pl/pmforms/tree/master" - }, - "time": "2023-08-15T19:02:00+00:00" - }, { "name": "pocketmine/bedrock-block-upgrade-schema", "version": "3.2.0", @@ -3007,9 +2961,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "dktapps/pmforms": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/src/thebigcrafter/Hydrogen/form/AsyncForm.php b/src/thebigcrafter/Hydrogen/form/AsyncForm.php deleted file mode 100644 index 83f89da..0000000 --- a/src/thebigcrafter/Hydrogen/form/AsyncForm.php +++ /dev/null @@ -1,71 +0,0 @@ - - * This source file is subject to the Apache-2.0 license that is bundled - * with this source code in the file LICENSE. - */ - -declare(strict_types=1); - -namespace thebigcrafter\Hydrogen\form; - -use dktapps\pmforms\CustomForm; -use dktapps\pmforms\CustomFormResponse; -use dktapps\pmforms\element\CustomFormElement; -use dktapps\pmforms\MenuForm; -use dktapps\pmforms\MenuOption; -use dktapps\pmforms\ModalForm; -use Generator; -use pocketmine\player\Player; -use SOFe\AwaitGenerator\Await; - -final class AsyncForm { - - /** - * @param CustomFormElement[] $elements - */ - public static function custom(Player $player, string $title, array $elements) : Generator { - $f = yield Await::RESOLVE; - $player->sendForm(new CustomForm( - $title, $elements, - function (Player $player, CustomFormResponse $result) use ($f) : void { - $f($result); - }, - function (Player $player) use ($f) : void { - $f(null); - } - )); - return yield Await::ONCE; - } - - /** - * @param MenuOption[] $options - */ - public static function menu(Player $player, string $title, string $text, array $options) : Generator { - $f = yield Await::RESOLVE; - $player->sendForm(new MenuForm( - $title, $text, $options, - function (Player $player, int $selectedOption) use ($f) : void { - $f($selectedOption); - }, - function (Player $player) use ($f) : void { - $f(null); - } - )); - return yield Await::ONCE; - } - - public static function modal(Player $player, string $title, string $text, string $yesButtonText = "gui.yes", string $noButtonText = "gui.no") : Generator { - $f = yield Await::RESOLVE; - $player->sendForm(new ModalForm( - $title, $text, - function (Player $player, bool $choice) use ($f) : void { - $f($choice); - }, - $yesButtonText, $noButtonText - )); - return yield Await::ONCE; - } -}