From 314d41f2878843393b13462b55536533ad3a290e Mon Sep 17 00:00:00 2001 From: xHyroM Date: Sat, 26 Aug 2023 16:46:41 +0200 Subject: [PATCH] feat: select storage provider from config --- .../main/java/dev/xhyrom/lighteco/common/config/Config.java | 4 ++++ .../dev/xhyrom/lighteco/common/storage/StorageFactory.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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 010b769..6d1b339 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 @@ -11,4 +11,8 @@ public class Config extends OkaeriConfig { @Comment("If you have multiple servers, you must set this property to a different value for each server.") @Comment("Used for local currencies.") public String server = "none"; + + @Comment("The storage provider to use.") + @Comment("Supported providers: memory") + public String storage = "memory"; } diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/storage/StorageFactory.java b/common/src/main/java/dev/xhyrom/lighteco/common/storage/StorageFactory.java index 6d847fd..2feb007 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/storage/StorageFactory.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/storage/StorageFactory.java @@ -13,7 +13,7 @@ public class StorageFactory { public Storage get() { // todo: use config - String provider = "memory";//this.plugin.getConfig().getString("storage.provider"); + String provider = this.plugin.getConfig().get("storage", String.class); return new Storage(this.plugin, createProvider(provider)); }