From 343edd17024223a2816fe635d5bca7ef65c7841d Mon Sep 17 00:00:00 2001 From: iZeaoGamer Date: Wed, 19 Sep 2018 22:17:39 +0100 Subject: [PATCH] New UPDATES available to merge (#9) * New PMMP scheduler updates * remove getServer() from scheduler task. * NEW PMMP Scheduler task update * UPDATES - Fixed class name not found when enabling. - remove getServer() from getScheduler() code. * Almost forgot to bump the API. --- plugin.yml | 6 +++--- src/icontrolu/ControlSession.php | 2 +- src/icontrolu/InventoryUpdateTask.php | 8 ++++---- src/icontrolu/InvisibilityTask.php | 7 +++---- src/icontrolu/iControlU.php | 7 ++++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugin.yml b/plugin.yml index 8d64c75..ab8ec86 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,8 +1,8 @@ name: iControlU main: icontrolu\iControlU -version: 1.3 +version: 1.4.0 author: Falkirks -api: [1.6.0] +api: [3.0.0, 4.0.0] load: POSTWORLD commands: icu: @@ -24,4 +24,4 @@ permissions: description: Stop controlling icu.exempt: default: op - description: Exempt from being controlled \ No newline at end of file + description: Exempt from being controlled diff --git a/src/icontrolu/ControlSession.php b/src/icontrolu/ControlSession.php index 498a557..ffa1d2b 100644 --- a/src/icontrolu/ControlSession.php +++ b/src/icontrolu/ControlSession.php @@ -44,6 +44,6 @@ public function stopControl(){ /* Reveal target */ $this->p->showPlayer($this->t); /* Schedule Invisibility Effect */ - $this->m->getServer()->getScheduler()->scheduleDelayedTask(new InvisibilityTask($this->m, $this->p), 20*10); + $this->m->getScheduler()->scheduleDelayedTask(new InvisibilityTask($this->m, $this->p), 20*10); } } diff --git a/src/icontrolu/InventoryUpdateTask.php b/src/icontrolu/InventoryUpdateTask.php index d403f38..ae7b27b 100644 --- a/src/icontrolu/InventoryUpdateTask.php +++ b/src/icontrolu/InventoryUpdateTask.php @@ -1,14 +1,14 @@ getOwner(); foreach($owner->s as $session){ $session->syncInventory(); } } -} \ No newline at end of file +} diff --git a/src/icontrolu/InvisibilityTask.php b/src/icontrolu/InvisibilityTask.php index 923a0ee..4227ce4 100644 --- a/src/icontrolu/InvisibilityTask.php +++ b/src/icontrolu/InvisibilityTask.php @@ -3,15 +3,14 @@ use pocketmine\Player; use pocketmine\plugin\Plugin; -use pocketmine\scheduler\PluginTask; +use pocketmine\scheduler\Task; -class InvisibilityTask extends PluginTask{ +class InvisibilityTask extends Task{ private $p; public function __construct(Plugin $main, Player $p){ - parent::__construct($main); $this->p = $p; } - public function onRun($tick){ + public function onRun(int $tick) : void{ $this->p->sendMessage("You are no longer invisible."); foreach($this->getOwner()->getServer()->getOnlinePlayers() as $online){ $online->showPlayer($this->p); diff --git a/src/icontrolu/iControlU.php b/src/icontrolu/iControlU.php index 8af576e..b964c65 100644 --- a/src/icontrolu/iControlU.php +++ b/src/icontrolu/iControlU.php @@ -7,6 +7,7 @@ use pocketmine\event\block\BlockBreakEvent; use pocketmine\event\block\BlockPlaceEvent; use pocketmine\event\entity\EntityMoveEvent; +use icontrolu\InventoryUpdateTask; use pocketmine\event\inventory\InventoryPickupItemEvent; use pocketmine\event\Listener; use pocketmine\event\player\PlayerAnimationEvent; @@ -24,14 +25,14 @@ class iControlU extends PluginBase implements CommandExecutor, Listener{ public $s; /** @var InventoryUpdateTask */ public $inv; - public function onEnable(){ + public function onEnable() : void{ $this->s = []; $this->b = []; $this->inv = new InventoryUpdateTask($this); - $this->getServer()->getScheduler()->scheduleRepeatingTask($this->inv, 5); + $this->getScheduler()->scheduleRepeatingTask($this->inv, 5); $this->getServer()->getPluginManager()->registerEvents($this, $this); } - public function onCommand(CommandSender $sender, Command $cmd, $label, array $args): bool{ + public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args): bool{ if($sender instanceof Player){ if(isset($args[0])){ switch($args[0]){