Skip to content

Commit 343edd1

Browse files
iZeaoGamerfalkirks
authored andcommitted
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.
1 parent 49890a0 commit 343edd1

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

plugin.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: iControlU
22
main: icontrolu\iControlU
3-
version: 1.3
3+
version: 1.4.0
44
author: Falkirks
5-
api: [1.6.0]
5+
api: [3.0.0, 4.0.0]
66
load: POSTWORLD
77
commands:
88
icu:
@@ -24,4 +24,4 @@ permissions:
2424
description: Stop controlling
2525
icu.exempt:
2626
default: op
27-
description: Exempt from being controlled
27+
description: Exempt from being controlled

src/icontrolu/ControlSession.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ public function stopControl(){
4444
/* Reveal target */
4545
$this->p->showPlayer($this->t);
4646
/* Schedule Invisibility Effect */
47-
$this->m->getServer()->getScheduler()->scheduleDelayedTask(new InvisibilityTask($this->m, $this->p), 20*10);
47+
$this->m->getScheduler()->scheduleDelayedTask(new InvisibilityTask($this->m, $this->p), 20*10);
4848
}
4949
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22
namespace icontrolu;
33

4-
use pocketmine\scheduler\PluginTask;
4+
use pocketmine\scheduler\Task;
55

6-
class InventoryUpdateTask extends PluginTask{
7-
public function onRun($tick){
6+
class InventoryUpdateTask extends Task{
7+
public function onRun(int $tick) : void{
88
/** @var iControlU $owner */
99
$owner = $this->getOwner();
1010
foreach($owner->s as $session){
1111
$session->syncInventory();
1212
}
1313
}
14-
}
14+
}

src/icontrolu/InvisibilityTask.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33

44
use pocketmine\Player;
55
use pocketmine\plugin\Plugin;
6-
use pocketmine\scheduler\PluginTask;
6+
use pocketmine\scheduler\Task;
77

8-
class InvisibilityTask extends PluginTask{
8+
class InvisibilityTask extends Task{
99
private $p;
1010
public function __construct(Plugin $main, Player $p){
11-
parent::__construct($main);
1211
$this->p = $p;
1312
}
14-
public function onRun($tick){
13+
public function onRun(int $tick) : void{
1514
$this->p->sendMessage("You are no longer invisible.");
1615
foreach($this->getOwner()->getServer()->getOnlinePlayers() as $online){
1716
$online->showPlayer($this->p);

src/icontrolu/iControlU.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use pocketmine\event\block\BlockBreakEvent;
88
use pocketmine\event\block\BlockPlaceEvent;
99
use pocketmine\event\entity\EntityMoveEvent;
10+
use icontrolu\InventoryUpdateTask;
1011
use pocketmine\event\inventory\InventoryPickupItemEvent;
1112
use pocketmine\event\Listener;
1213
use pocketmine\event\player\PlayerAnimationEvent;
@@ -24,14 +25,14 @@ class iControlU extends PluginBase implements CommandExecutor, Listener{
2425
public $s;
2526
/** @var InventoryUpdateTask */
2627
public $inv;
27-
public function onEnable(){
28+
public function onEnable() : void{
2829
$this->s = [];
2930
$this->b = [];
3031
$this->inv = new InventoryUpdateTask($this);
31-
$this->getServer()->getScheduler()->scheduleRepeatingTask($this->inv, 5);
32+
$this->getScheduler()->scheduleRepeatingTask($this->inv, 5);
3233
$this->getServer()->getPluginManager()->registerEvents($this, $this);
3334
}
34-
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args): bool{
35+
public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args): bool{
3536
if($sender instanceof Player){
3637
if(isset($args[0])){
3738
switch($args[0]){

0 commit comments

Comments
 (0)