Skip to content
This repository was archived by the owner on Apr 27, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ProjectInfinity/PocketVote/task/DiagnoseTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct($version, $player) {
$this->player = $player;
}

public function onRun() {
public function onRun() : void {

if($this->identity === null) return;

Expand Down Expand Up @@ -56,7 +56,7 @@ public function onRun() {
$this->setResult(json_decode($res));
}

public function onCompletion(Server $server) {
public function onCompletion(Server $server) : void {
$player = $this->player === 'CONSOLE' ? new ConsoleCommandSender() : $server->getPlayer($this->player);
if($player === null) return;

Expand Down Expand Up @@ -95,4 +95,4 @@ public function onCompletion(Server $server) {
$player->sendMessage(TextFormat::RED.'Please wait before trying to use this command again.');
}
}
}
}
4 changes: 2 additions & 2 deletions src/ProjectInfinity/PocketVote/task/HeartbeatTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct($identity) {
];
}

public function onRun() {
public function onRun() : void {

if($this->secret === null || $this->identity === null) return;

Expand All @@ -67,4 +67,4 @@ public function onRun() {
curl_exec($curl);
curl_close($curl);
}
}
}
6 changes: 3 additions & 3 deletions src/ProjectInfinity/PocketVote/task/SlaveCheckTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct() {
$this->hash = md5(PocketVote::getPlugin()->getServer()->getIp().PocketVote::getPlugin()->getServer()->getPort());
}

public function onRun() {
public function onRun() : void {

$db = new \mysqli($this->mysql_host, $this->mysql_username, $this->mysql_password, $this->mysql_database, $this->mysql_port);
# Ensure we are actually connected.
Expand Down Expand Up @@ -81,7 +81,7 @@ public function onRun() {

}

public function onCompletion(Server $server) {
public function onCompletion(Server $server) :void {

if(!$this->hasResult()) {
$server->getLogger()->emergency('A database check failed.');
Expand All @@ -98,4 +98,4 @@ public function onCompletion(Server $server) {
);
}
}
}
}
6 changes: 3 additions & 3 deletions src/ProjectInfinity/PocketVote/task/TopVoterTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct($identity, $player) {
$this->version = PocketVote::getPlugin()->getDescription()->getVersion();
}

public function onRun() {
public function onRun() : void {
$curl = curl_init($this->isDev ? 'http://127.0.0.1/v2/top/10' : 'https://api.pocketvote.io/v2/top/10');

curl_setopt_array($curl, [
Expand All @@ -47,7 +47,7 @@ public function onRun() {
$this->setResult(json_decode($res));
}

public function onCompletion(Server $server) {
public function onCompletion(Server $server) : void {
$player = $this->player === 'CONSOLE' ? new ConsoleCommandSender() : $server->getPlayer($this->player);
if($player === null) return;

Expand Down Expand Up @@ -80,4 +80,4 @@ public function onCompletion(Server $server) {

if(count($result->payload) === 0) $player->sendMessage(TextFormat::GRAY.'No voters found, start voting!');
}
}
}
6 changes: 3 additions & 3 deletions src/ProjectInfinity/PocketVote/task/VoteLinkTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct($identity) {
$this->version = PocketVote::getPlugin()->getDescription()->getVersion();
}

public function onRun() {
public function onRun() : void {
$curl = curl_init($this->isDev ? 'http://dev.mcpe.guru/api/link' : 'https://mcpe.guru/api/link');

curl_setopt_array($curl, [
Expand Down Expand Up @@ -56,7 +56,7 @@ public function onRun() {
curl_close($curl);
}

public function onCompletion(Server $server) {
public function onCompletion(Server $server) : void {
$server->getLogger()->debug('[PocketVote] Attempting to retrieve vote link.');

if(!$this->hasResult()) {
Expand Down Expand Up @@ -92,4 +92,4 @@ public function onCompletion(Server $server) {
PocketVote::getPlugin()->getVoteManager()->setVoteLink($result->payload->url);
}
}
}
}