From 0c35ff18b0922d731c14649e1152357f9f049cc0 Mon Sep 17 00:00:00 2001 From: xHyroM Date: Wed, 30 Aug 2023 00:48:38 +0200 Subject: [PATCH] feat: saveInternal in config --- .../dev/xhyrom/lighteco/common/config/Config.java | 3 +++ .../lighteco/common/model/currency/Currency.java | 11 ----------- .../common/plugin/AbstractLightEcoPlugin.java | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/config/Config.java b/common/src/main/java/dev/xhyrom/lighteco/common/config/Config.java index 6492692..cffc2b5 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/config/Config.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/config/Config.java @@ -17,6 +17,9 @@ public class Config extends OkaeriConfig { @Comment("Storage settings.") public StorageConfig storage = new StorageConfig(); + @Comment("Save interval to storage in seconds.") + public long saveInterval = 5L; + @Comment("Messages") public MessageConfig messages = new MessageConfig(); } diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/model/currency/Currency.java b/common/src/main/java/dev/xhyrom/lighteco/common/model/currency/Currency.java index 569a738..f6595e4 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/model/currency/Currency.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/model/currency/Currency.java @@ -1,13 +1,9 @@ package dev.xhyrom.lighteco.common.model.currency; -import dev.xhyrom.lighteco.common.model.user.User; import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin; import lombok.Getter; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; public class Currency { private final LightEcoPlugin plugin; @@ -39,11 +35,4 @@ public class Currency { public int fractionalDigits() { return proxy.fractionalDigits(); } - - public List getTopUsers(int length) { - List users = new ArrayList<>(); - users.add(new User(plugin, new UUID(0, 0))); - - return users; - } } diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/plugin/AbstractLightEcoPlugin.java b/common/src/main/java/dev/xhyrom/lighteco/common/plugin/AbstractLightEcoPlugin.java index 93228bb..9ef7508 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/plugin/AbstractLightEcoPlugin.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/plugin/AbstractLightEcoPlugin.java @@ -55,7 +55,7 @@ public abstract class AbstractLightEcoPlugin implements LightEcoPlugin { LightEcoProvider.set(this.api); this.registerApiOnPlatform(this.api); - this.getBootstrap().getScheduler().asyncRepeating(new UserSaveTask(this), 3, TimeUnit.SECONDS); + this.getBootstrap().getScheduler().asyncRepeating(new UserSaveTask(this), this.config.saveInterval, TimeUnit.SECONDS); } public final void disable() {