Skip to content

Commit

Permalink
save with interval
Browse files Browse the repository at this point in the history
  • Loading branch information
brokiem committed Aug 15, 2022
1 parent afdaa8b commit a438eb7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/czechpmdevs/simplehome/SimpleHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use pocketmine\command\Command;
use pocketmine\player\Player;
use pocketmine\plugin\PluginBase;
use pocketmine\scheduler\ClosureTask;
use pocketmine\utils\AssumptionFailedError;
use pocketmine\utils\Config;
use pocketmine\utils\Utils;
Expand Down Expand Up @@ -40,10 +41,14 @@ class SimpleHome extends PluginBase {
private array $commands = [];

public function onEnable(): void {
self::$instance = $this;
$this->registerCommands();
$this->loadData();
}
self::$instance = $this;
$this->registerCommands();
$this->loadData();

$this->getScheduler()->scheduleRepeatingTask(new ClosureTask(function(): void {
$this->saveData();
}), 400);
}

public function onDisable(): void {
$this->saveData();
Expand Down

0 comments on commit a438eb7

Please sign in to comment.