Skip to content

Commit

Permalink
feat: release v4.0.5
Browse files Browse the repository at this point in the history
- Added Spanish language
- Fixed an issue with the build action
- Code refactoring
  • Loading branch information
cooldogedev committed Apr 20, 2024
1 parent 5ed0311 commit 0d79b2d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: BedrockEconomy
version: 4.0.4
version: 4.0.5
api: [ 5.0.0 ]
author: cooldogedev
main: cooldogedev\BedrockEconomy\BedrockEconomy
Expand Down
2 changes: 1 addition & 1 deletion resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
config-version: 4.0.4
config-version: 4.0.5

language: en-US

Expand Down
28 changes: 10 additions & 18 deletions src/cooldogedev/BedrockEconomy/BedrockEconomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ final class BedrockEconomy extends PluginBase
/**
* @var array<int, array{string, string}>|null
*/
private ?array $migrationInfo;
private array $migrationInfo;

private bool $ready = false;

Expand Down Expand Up @@ -141,21 +141,16 @@ function (): void {

$this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this);
$this->registerCommands();

if ($this->getConfig()->get("cache-invalidation") === 0) {
return;
if ($this->getConfig()->get("cache-invalidation") > 0) {
$this->getScheduler()->scheduleRepeatingTask(
task: new ClosureTask(function (): void {
if ($this->ready) {
GlobalCache::invalidate();
}
}),
period: $this->getConfig()->getNested("cache.invalidation") * 20
);
}

$this->getScheduler()->scheduleRepeatingTask(
task: new ClosureTask(function (): void {
if (!$this->ready) {
return;
}

GlobalCache::invalidate();
}),
period: $this->getConfig()->getNested("cache.invalidation") * 20
);
}

private function checkConfig(): bool
Expand All @@ -172,15 +167,13 @@ private function checkConfig(): bool
}

$this->reloadConfig();

try {
$this->getConfig()->set("config-version", $this->getDescription()->getVersion());
$this->getConfig()->save();
} catch (JsonException $e) {
$this->getLogger()->critical("An error occurred while attempting to generate the new config, " . $e->getMessage());
return false;
}

return true;
}

Expand Down Expand Up @@ -212,7 +205,6 @@ private function registerCommands(): void

$command = new $className($this, $commandData["name"], $commandData["description"], $commandData["aliases"]);
$command->setUsage(TextFormat::colorize($commandData["usage"]));

$commands[] = $command;
}

Expand Down

0 comments on commit 0d79b2d

Please sign in to comment.