A PocketMine-MP Virion to easily do captchas within Minecraft:Bedrock / Pocket Edition
Installation is easy, you may get a compiled phar here or integrate the virion itself into your plugin.
This virion is purely object oriented. So, to use it you'll just have to import the CaptchaDialog
object.
You'll need to import this class in order to easily use it within our code.
<?php
use CortexPE\CaptchaAPI\CaptchaDialog;
Use the pre-set constants available on CaptchaDialog
or you can provide your own for the length
$form = new CaptchaDialog(CaptchaDialog::CAPTCHA_TYPE_ALPHANUMERIC, CaptchaDialog::CAPTCHA_LENGTH_MODERATE);
Send the captha dialog to the player with
$player->sendForm($form);
Basic usage is easy as 1-2-3! 🎉
Adding more function could be done by setting the "success callback" and the "failure callback" in such a way like this:
$form->setSuccessCallable(function (Player $player){
// do stuff when the captcha is successfully solved
});
$form->setFailureCallable(function (Player $player){
// do stuff when the captcha failed to be solved
});
Want the form to stay on screen if they entered the wrong captcha or tried to exit it?
This could easily be done by setting the 'persistent' status.
$form->setPersistent(true);
This API was made with ❤️ by CortexPE, Enjoy!~ :3