Skip to content
This repository was archived by the owner on Apr 27, 2025. It is now read-only.

Commit 3407150

Browse files
Ensure PocketVote works with the latest PMMP.
This adds the now required return types.
1 parent a9cedf6 commit 3407150

File tree

9 files changed

+26
-24
lines changed

9 files changed

+26
-24
lines changed

plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: PocketVote
22
main: ProjectInfinity\PocketVote\PocketVote
3-
version: 2.0.1
4-
api: [2.0.0, 3.0.0-ALPHA1, 3.0.0-ALPHA2, 3.0.0-ALPHA3, 3.0.0-ALPHA4, 3.0.0-ALPHA5]
3+
version: 2.0.2
4+
api: [3.0.0-ALPHA6, 3.0.0-ALPHA7]
55
author: ProjectInfinity
66
permissions:
77
pocketvote.admin:

src/ProjectInfinity/PocketVote/cmd/PocketVoteCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use pocketmine\command\Command;
66
use pocketmine\command\CommandSender;
77
use pocketmine\command\PluginIdentifiableCommand;
8+
use pocketmine\plugin\Plugin;
89
use pocketmine\utils\TextFormat;
910
use ProjectInfinity\PocketVote\PocketVote;
1011
use ProjectInfinity\PocketVote\task\guru\SetLinkNameTask;
@@ -19,7 +20,7 @@ public function __construct(PocketVote $plugin) {
1920
$this->plugin = $plugin;
2021
}
2122

22-
public function execute(CommandSender $sender, $commandLabel, array $args) {
23+
public function execute(CommandSender $sender, string $commandLabel, array $args) {
2324
if(!$sender->hasPermission('pocketvote.admin')) {
2425
$sender->sendMessage(TextFormat::RED.'You do not have permission to administer PocketVote.');
2526
return true;
@@ -187,7 +188,7 @@ public function execute(CommandSender $sender, $commandLabel, array $args) {
187188
return true;
188189
}
189190

190-
public function getPlugin() {
191+
public function getPlugin(): Plugin {
191192
return $this->plugin;
192193
}
193194
}

src/ProjectInfinity/PocketVote/cmd/VoteCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use pocketmine\command\Command;
66
use pocketmine\command\CommandSender;
77
use pocketmine\command\PluginIdentifiableCommand;
8+
use pocketmine\plugin\Plugin;
89
use pocketmine\utils\TextFormat;
910
use ProjectInfinity\PocketVote\PocketVote;
1011
use ProjectInfinity\PocketVote\task\TopVoterTask;
@@ -18,7 +19,7 @@ public function __construct(PocketVote $plugin) {
1819
$this->plugin = $plugin;
1920
}
2021

21-
public function execute(CommandSender $sender, $commandLabel, array $args) {
22+
public function execute(CommandSender $sender, String $commandLabel, array $args) {
2223
if(!$sender->hasPermission('pocketvote.vote')) {
2324
$sender->sendMessage(TextFormat::RED.'You do not have permission use /vote.');
2425
return true;
@@ -42,7 +43,7 @@ public function execute(CommandSender $sender, $commandLabel, array $args) {
4243
return true;
4344
}
4445

45-
public function getPlugin() {
46+
public function getPlugin(): Plugin {
4647
return $this->plugin;
4748
}
4849
}

src/ProjectInfinity/PocketVote/cmd/guru/GuAddCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct(PocketVote $plugin) {
1717
$this->plugin = $plugin;
1818
}
1919

20-
public function execute(CommandSender $sender, $commandLabel, array $args) {
20+
public function execute(CommandSender $sender, String $commandLabel, array $args) {
2121
if(!$sender->hasPermission('pocketvote.admin')) {
2222
$sender->sendMessage(TextFormat::RED.'You do not have permission to do that!');
2323
return true;

src/ProjectInfinity/PocketVote/cmd/guru/GuDelCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct(PocketVote $plugin) {
1717
$this->plugin = $plugin;
1818
}
1919

20-
public function execute(CommandSender $sender, $commandLabel, array $args) {
20+
public function execute(CommandSender $sender, String $commandLabel, array $args) {
2121
if(!$sender->hasPermission('pocketvote.admin')) {
2222
$sender->sendMessage(TextFormat::RED.'You do not have permission to do that!');
2323
return true;

src/ProjectInfinity/PocketVote/cmd/guru/GuListCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function __construct(PocketVote $plugin) {
1515
$this->plugin = $plugin;
1616
}
1717

18-
public function execute(CommandSender $sender, $commandLabel, array $args) {
18+
public function execute(CommandSender $sender, String $commandLabel, array $args) {
1919
if(!$sender->hasPermission('pocketvote.admin')) {
2020
$sender->sendMessage(TextFormat::RED.'You do not have permission to do that.');
2121
return true;

src/ProjectInfinity/PocketVote/cmd/guru/GuruCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function __construct() {
1212
parent::__construct('guru', 'MCPE Guru help command', '/guru [subject]', ['gu']);
1313
}
1414

15-
public function execute(CommandSender $sender, $commandLabel, array $args) {
15+
public function execute(CommandSender $sender, String $commandLabel, array $args) {
1616
if(!$sender->hasPermission('pocketvote.admin')) {
1717
$sender->sendMessage(TextFormat::RED.'You do not have permission to do that.');
1818
return true;
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<?php
2-
3-
namespace ProjectInfinity\PocketVote\task;
4-
5-
use pocketmine\scheduler\Task;
6-
use ProjectInfinity\PocketVote\PocketVote;
7-
8-
class ExpireVotesTask extends Task {
9-
10-
public function onRun($currentTick) {
11-
PocketVote::getPlugin()->getLogger()->debug('Cleaning up expired votes.');
12-
PocketVote::getPlugin()->getVoteManager()->expireVotes();
13-
}
1+
<?php
2+
3+
namespace ProjectInfinity\PocketVote\task;
4+
5+
use pocketmine\scheduler\Task;
6+
use ProjectInfinity\PocketVote\PocketVote;
7+
8+
class ExpireVotesTask extends Task {
9+
10+
public function onRun(int $currentTick) {
11+
PocketVote::getPlugin()->getLogger()->debug('Cleaning up expired votes.');
12+
PocketVote::getPlugin()->getVoteManager()->expireVotes();
13+
}
1414
}

src/ProjectInfinity/PocketVote/task/SchedulerTask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function __construct(PocketVote $plugin) {
1515
$this->version = $plugin->getDescription()->getVersion();
1616
}
1717

18-
public function onRun($currentTick) {
18+
public function onRun(int $currentTick) {
1919
$this->plugin->getLogger()->debug('Checking for outstanding votes.');
2020
if(!$this->plugin->multiserver || ($this->plugin->multiserver && strtolower($this->plugin->multiserver_role) === 'master')) $this->plugin->getServer()->getScheduler()->scheduleAsyncTask(new VoteCheckTask($this->plugin->identity, $this->plugin->secret, $this->version));
2121
if($this->plugin->multiserver && strtolower($this->plugin->multiserver_role) === 'slave') $this->plugin->getServer()->getScheduler()->scheduleAsyncTask(new SlaveCheckTask());

0 commit comments

Comments
 (0)