Skip to content

Commit

Permalink
New UPDATES available to merge (#9)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
iZeaoGamer authored and falkirks committed Sep 19, 2018
1 parent 49890a0 commit 343edd1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -24,4 +24,4 @@ permissions:
description: Stop controlling
icu.exempt:
default: op
description: Exempt from being controlled
description: Exempt from being controlled
2 changes: 1 addition & 1 deletion src/icontrolu/ControlSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
8 changes: 4 additions & 4 deletions src/icontrolu/InventoryUpdateTask.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
namespace icontrolu;

use pocketmine\scheduler\PluginTask;
use pocketmine\scheduler\Task;

class InventoryUpdateTask extends PluginTask{
public function onRun($tick){
class InventoryUpdateTask extends Task{
public function onRun(int $tick) : void{
/** @var iControlU $owner */
$owner = $this->getOwner();
foreach($owner->s as $session){
$session->syncInventory();
}
}
}
}
7 changes: 3 additions & 4 deletions src/icontrolu/InvisibilityTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions src/icontrolu/iControlU.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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]){
Expand Down

0 comments on commit 343edd1

Please sign in to comment.