Hi, my vote plugin doesn't seem to be working for some reason. Nothing pops up in the logger or sends any messages. I'm pretty sure it's supposed to work. Vote API Documentation: https://minecraftpocket-servers.com/help/api/ Code: PHP: <?phpnamespace core\essential\task;use core\CorePlayer;use core\crate\object\Crate;use pocketmine\scheduler\AsyncTask;use pocketmine\Server;use pocketmine\utils\Utils;class CheckVoteTask extends AsyncTask { const NO_DATA = 0; const NOT_CLAIMED = 1; const CLAIMED = 2; /** @var string */ private $player; /** @var array */ private $data; /** * CheckVoteTask constructor. * * @param string $player * @param array $data */ public function __construct(string $player, array $data) { $this->player = $player; $this->data = $data; } public function onRun() { $get = Utils::getURL(str_replace("{USERNAME}", $this->player, $this->data["check"])); $this->setResult($get); } /** * @param Server $server */ public function onCompletion(Server $server) { $player = $server->getPlayer($this->player); if(!$player instanceof CorePlayer) { return; } switch($this->getResult()) { case self::NO_DATA: $player->sendTranslatedMessage("VOTE_CHECK_NO_DATA"); break; case self::NOT_CLAIMED: $player->sendTranslatedMessage("VOTE_SUCCESS"); $player->getCore()->broadcastMessage("VOTE_BROADCAST", ["name" => $this->player]); $player->addKeys(Crate::SPECIAL, 2); $player->setChecked(); $player->setVoted(); $server->getAsyncPool()->submitTask(new ClaimVoteTask($this->player, $this->data)); break; case self::CLAIMED: $player->sendTranslatedMessage("VOTE_CHECK_CLAIMED"); $player->setChecked(); $player->setVoted(); break; default: $player->sendTranslatedMessage("VOTE_CHECK_ERROR"); } }} PHP: <?phpnamespace core\essential\task;use pocketmine\scheduler\AsyncTask;use pocketmine\Server;use pocketmine\utils\Utils;class ClaimVoteTask extends AsyncTask { const NOT_CLAIMED = 0; const CLAIMED = 1; /** @var string */ private $player; /** @var array */ private $data; /** * ClaimVoteTask constructor. * * @param string $player * @param array $data */ public function __construct(string $player, array $data) { $this->player = $player; $this->data = $data; } public function onRun() { $post = Utils::postURL(str_replace("{USERNAME}", $this->player, $this->data["claim"]), []); $this->setResult($post); } /** * @param Server $server */ public function onCompletion(Server $server) { switch($this->getResult()) { case self::NOT_CLAIMED: $server->getLogger()->info("Successfully set {$this->player}'s vote as claimed!"); break; case self::CLAIMED: $server->getLogger()->info("{$this->player}'s is already claimed!"); break; default: $server->getLogger()->warning("Error while claiming {$this->player}'s vote!"); } }}
the download link in the api documentation refers to ldx's vote reward plugin from the old pocketmine
If it weren't compatible with the current API, it would give an API error on startup, unless this was bypassed without properly updating the plugin. Since OP said there was no output, I assume that wasn't the case. Does the plugin not load? Where did you download the plugin from? If I can see all of the source code, it would be helpful
I'm only showing a minimum amount of code because some of it includes some private info. $data variable represents the json decoded version of a vrc file from https://minecraftpocket-servers.com/.
You didn't specify what part of the plugin didn't work, so I have no clue whether it loads, the command runs, what you expect to happen, etc. If it isn't loading, I need to see your PluginBase file, or at least part of it.
this is on coding an API interface for the site PMMP plugin is irrelevant here please stop creating false information it make no sense since you properly set default thus there will at least be error