From ba8e2b2929cbf51760237fa1c7a8b119df66a315 Mon Sep 17 00:00:00 2001 From: carm Date: Mon, 9 Jun 2025 23:42:13 +0800 Subject: [PATCH] feat(user): Fixed user interfaces error --- base/color/pom.xml | 2 +- base/command-alias/pom.xml | 2 +- base/command/pom.xml | 2 +- base/gui/pom.xml | 2 +- base/main/pom.xml | 2 +- base/messages/pom.xml | 2 +- base/storage/pom.xml | 2 +- base/user/pom.xml | 2 +- .../lib/easyplugin/user/AbstractUserData.java | 5 +++++ .../cc/carm/lib/easyplugin/user/UserData.java | 5 ----- .../carm/lib/easyplugin/user/UserDataManager.java | 15 ++++++++------- .../lib/easyplugin/user/UserDataRegistry.java | 2 -- base/utils/pom.xml | 2 +- collection/all/pom.xml | 2 +- collection/bom/pom.xml | 2 +- collection/common/pom.xml | 2 +- extension/gh-checker/pom.xml | 2 +- extension/papi/pom.xml | 2 +- extension/vault/pom.xml | 2 +- pom.xml | 2 +- 20 files changed, 29 insertions(+), 30 deletions(-) diff --git a/base/color/pom.xml b/base/color/pom.xml index fde67dd..bbc9775 100644 --- a/base/color/pom.xml +++ b/base/color/pom.xml @@ -6,7 +6,7 @@ cc.carm.lib easyplugin-parent - 1.5.13 + 1.5.14 ../../pom.xml diff --git a/base/command-alias/pom.xml b/base/command-alias/pom.xml index 757239a..14bddcb 100644 --- a/base/command-alias/pom.xml +++ b/base/command-alias/pom.xml @@ -6,7 +6,7 @@ cc.carm.lib easyplugin-parent - 1.5.13 + 1.5.14 ../../pom.xml diff --git a/base/command/pom.xml b/base/command/pom.xml index 7910f07..f343127 100644 --- a/base/command/pom.xml +++ b/base/command/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.5.13 + 1.5.14 ../../pom.xml 4.0.0 diff --git a/base/gui/pom.xml b/base/gui/pom.xml index 74df82a..74af054 100644 --- a/base/gui/pom.xml +++ b/base/gui/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.5.13 + 1.5.14 ../../pom.xml 4.0.0 diff --git a/base/main/pom.xml b/base/main/pom.xml index f75994e..3ee135d 100644 --- a/base/main/pom.xml +++ b/base/main/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.5.13 + 1.5.14 ../../pom.xml 4.0.0 diff --git a/base/messages/pom.xml b/base/messages/pom.xml index 388984e..e33754b 100644 --- a/base/messages/pom.xml +++ b/base/messages/pom.xml @@ -6,7 +6,7 @@ cc.carm.lib easyplugin-parent - 1.5.13 + 1.5.14 ../../pom.xml diff --git a/base/storage/pom.xml b/base/storage/pom.xml index 1eb1fe2..38357a5 100644 --- a/base/storage/pom.xml +++ b/base/storage/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.5.13 + 1.5.14 ../../pom.xml 4.0.0 diff --git a/base/user/pom.xml b/base/user/pom.xml index a7d36c2..cbb4b99 100644 --- a/base/user/pom.xml +++ b/base/user/pom.xml @@ -6,7 +6,7 @@ cc.carm.lib easyplugin-parent - 1.5.13 + 1.5.14 ../../pom.xml diff --git a/base/user/src/main/java/cc/carm/lib/easyplugin/user/AbstractUserData.java b/base/user/src/main/java/cc/carm/lib/easyplugin/user/AbstractUserData.java index ad00b6c..f810892 100644 --- a/base/user/src/main/java/cc/carm/lib/easyplugin/user/AbstractUserData.java +++ b/base/user/src/main/java/cc/carm/lib/easyplugin/user/AbstractUserData.java @@ -17,6 +17,11 @@ public abstract class AbstractUserData implements UserData { this.key = key; } + @Override + public @NotNull K key() { + return key; + } + /** * @param dropping true if the data is dropping, false otherwise */ diff --git a/base/user/src/main/java/cc/carm/lib/easyplugin/user/UserData.java b/base/user/src/main/java/cc/carm/lib/easyplugin/user/UserData.java index a704fc2..927ebef 100644 --- a/base/user/src/main/java/cc/carm/lib/easyplugin/user/UserData.java +++ b/base/user/src/main/java/cc/carm/lib/easyplugin/user/UserData.java @@ -6,11 +6,6 @@ public interface UserData { @NotNull K key(); - @Deprecated - default @NotNull K getKey() { - return key(); - } - /** * @param dropping true if the data is dropping, false otherwise */ diff --git a/base/user/src/main/java/cc/carm/lib/easyplugin/user/UserDataManager.java b/base/user/src/main/java/cc/carm/lib/easyplugin/user/UserDataManager.java index 8ff94d4..ce10f23 100644 --- a/base/user/src/main/java/cc/carm/lib/easyplugin/user/UserDataManager.java +++ b/base/user/src/main/java/cc/carm/lib/easyplugin/user/UserDataManager.java @@ -68,7 +68,8 @@ public abstract class UserDataManager> implemen protected abstract void saveData(@NotNull U data) throws Exception; - public @NotNull Map getDataCache() { + @Override + public @NotNull Map cache() { return dataCache; } @@ -107,7 +108,7 @@ public abstract class UserDataManager> implemen @Override public @NotNull CompletableFuture save(@NotNull U user) { return CompletableFuture.supplyAsync(() -> { - String identifier = serializeKey(user.getKey()); + String identifier = serializeKey(user.key()); try { long s1 = System.currentTimeMillis(); @@ -195,12 +196,12 @@ public abstract class UserDataManager> implemen @Override public void saveAll() { - if (getDataCache().isEmpty()) return; - for (U u : getDataCache().values()) { + if (cache().isEmpty()) return; + for (U u : cache().values()) { try { saveData(u); } catch (Exception e) { - getPlugin().error("保存用户 " + serializeKey(u.getKey()) + " 数据失败,请检查相关配置!"); + getPlugin().error("保存用户 " + serializeKey(u.key()) + " 数据失败,请检查相关配置!"); e.printStackTrace(); } } @@ -209,8 +210,8 @@ public abstract class UserDataManager> implemen @Override public int unloadAll(boolean save) { if (save) saveAll(); - int size = getDataCache().size(); - getDataCache().clear(); + int size = cache().size(); + cache().clear(); return size; } diff --git a/base/user/src/main/java/cc/carm/lib/easyplugin/user/UserDataRegistry.java b/base/user/src/main/java/cc/carm/lib/easyplugin/user/UserDataRegistry.java index 9d5734d..6e243f0 100644 --- a/base/user/src/main/java/cc/carm/lib/easyplugin/user/UserDataRegistry.java +++ b/base/user/src/main/java/cc/carm/lib/easyplugin/user/UserDataRegistry.java @@ -25,7 +25,6 @@ public interface UserDataRegistry> { @NotNull Logger getLogger(); - @NotNull Map cache(); default String serializeKey(@NotNull K key) { @@ -40,7 +39,6 @@ public interface UserDataRegistry> { return load(key, () -> cache); } - @Unmodifiable default @NotNull Set list() { return ImmutableSet.copyOf(cache().values()); diff --git a/base/utils/pom.xml b/base/utils/pom.xml index 53eec5d..11260e4 100644 --- a/base/utils/pom.xml +++ b/base/utils/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.5.13 + 1.5.14 ../../pom.xml 4.0.0 diff --git a/collection/all/pom.xml b/collection/all/pom.xml index 82b4f25..2176e1d 100644 --- a/collection/all/pom.xml +++ b/collection/all/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.5.13 + 1.5.14 ../../pom.xml 4.0.0 diff --git a/collection/bom/pom.xml b/collection/bom/pom.xml index 0995f40..9730ad2 100644 --- a/collection/bom/pom.xml +++ b/collection/bom/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.5.13 + 1.5.14 ../../pom.xml 4.0.0 diff --git a/collection/common/pom.xml b/collection/common/pom.xml index d18a475..8ca0355 100644 --- a/collection/common/pom.xml +++ b/collection/common/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.5.13 + 1.5.14 ../../pom.xml 4.0.0 diff --git a/extension/gh-checker/pom.xml b/extension/gh-checker/pom.xml index 9157aab..38e1e70 100644 --- a/extension/gh-checker/pom.xml +++ b/extension/gh-checker/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.5.13 + 1.5.14 ../../pom.xml 4.0.0 diff --git a/extension/papi/pom.xml b/extension/papi/pom.xml index 0ddc754..f668535 100644 --- a/extension/papi/pom.xml +++ b/extension/papi/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.5.13 + 1.5.14 ../../pom.xml 4.0.0 diff --git a/extension/vault/pom.xml b/extension/vault/pom.xml index c814e21..067b90d 100644 --- a/extension/vault/pom.xml +++ b/extension/vault/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.5.13 + 1.5.14 ../../pom.xml 4.0.0 diff --git a/pom.xml b/pom.xml index ec8bd2c..7ad9ddb 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ cc.carm.lib easyplugin-parent pom - 1.5.13 + 1.5.14 base/color base/utils