From 0c71b7696619aa9cc54533f8cce12e122199bac7 Mon Sep 17 00:00:00 2001 From: Potatoshare88 Date: Wed, 6 Jun 2018 11:04:28 +0900 Subject: [PATCH] Update Task --- EconomyAPI/src/onebone/economyapi/EconomyAPI.php | 2 +- .../src/onebone/economyapi/task/MySQLPingTask.php | 10 ++++++---- EconomyAPI/src/onebone/economyapi/task/SaveTask.php | 9 +++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/EconomyAPI/src/onebone/economyapi/EconomyAPI.php b/EconomyAPI/src/onebone/economyapi/EconomyAPI.php index b1a92d5d..94ffb488 100644 --- a/EconomyAPI/src/onebone/economyapi/EconomyAPI.php +++ b/EconomyAPI/src/onebone/economyapi/EconomyAPI.php @@ -306,7 +306,7 @@ public function onEnable(){ $this->initialize(); if($this->getConfig()->get("auto-save-interval") > 0){ - $this->getServer()->getScheduler()->scheduleDelayedRepeatingTask(new SaveTask($this), $this->getConfig()->get("auto-save-interval") * 1200, $this->getConfig()->get("auto-save-interval") * 1200); + $this->getScheduler()->scheduleDelayedRepeatingTask(new SaveTask($this), $this->getConfig()->get("auto-save-interval") * 1200, $this->getConfig()->get("auto-save-interval") * 1200); } $this->getServer()->getPluginManager()->registerEvents($this, $this); diff --git a/EconomyAPI/src/onebone/economyapi/task/MySQLPingTask.php b/EconomyAPI/src/onebone/economyapi/task/MySQLPingTask.php index 49f7cfad..37d17332 100644 --- a/EconomyAPI/src/onebone/economyapi/task/MySQLPingTask.php +++ b/EconomyAPI/src/onebone/economyapi/task/MySQLPingTask.php @@ -22,20 +22,22 @@ use onebone\economyapi\EconomyAPI; -use pocketmine\scheduler\PluginTask; +use pocketmine\scheduler\Task; -class MySQLPingTask extends PluginTask{ +class MySQLPingTask extends Task{ private $mysql; + + private $plugin public function __construct(EconomyAPI $plugin, \mysqli $mysql){ - parent::__construct($plugin); + $this->plugin = $plugin; $this->mysql = $mysql; } public function onRun(int $currentTick){ if(!$this->mysql->ping()){ - $this->getOwner()->openProvider(); + $this->plugin->openProvider(); } } } diff --git a/EconomyAPI/src/onebone/economyapi/task/SaveTask.php b/EconomyAPI/src/onebone/economyapi/task/SaveTask.php index 1c6ecd44..be41d0b0 100644 --- a/EconomyAPI/src/onebone/economyapi/task/SaveTask.php +++ b/EconomyAPI/src/onebone/economyapi/task/SaveTask.php @@ -22,14 +22,15 @@ use onebone\economyapi\EconomyAPI; -use pocketmine\scheduler\PluginTask; +use pocketmine\scheduler\Task; -class SaveTask extends PluginTask { +class SaveTask extends Task { + private $plugin; public function __construct(EconomyAPI $plugin){ - parent::__construct($plugin); + $this->plugin = $plugin; } public function onRun(int $currentTick){ - $this->getOwner()->saveAll(); + $this->plugin->saveAll(); } }