mirror of
https://github.com/CarmJos/EasyPlugin.git
synced 2026-06-04 08:38:17 +08:00
feat(user): Fixed user interfaces error
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ public abstract class AbstractUserData<K> implements UserData<K> {
|
|||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull K key() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dropping true if the data is dropping, false otherwise
|
* @param dropping true if the data is dropping, false otherwise
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,11 +6,6 @@ public interface UserData<K> {
|
|||||||
|
|
||||||
@NotNull K key();
|
@NotNull K key();
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
default @NotNull K getKey() {
|
|
||||||
return key();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dropping true if the data is dropping, false otherwise
|
* @param dropping true if the data is dropping, false otherwise
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ public abstract class UserDataManager<K, U extends AbstractUserData<K>> implemen
|
|||||||
|
|
||||||
protected abstract void saveData(@NotNull U data) throws Exception;
|
protected abstract void saveData(@NotNull U data) throws Exception;
|
||||||
|
|
||||||
public @NotNull Map<K, U> getDataCache() {
|
@Override
|
||||||
|
public @NotNull Map<K, U> cache() {
|
||||||
return dataCache;
|
return dataCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +108,7 @@ public abstract class UserDataManager<K, U extends AbstractUserData<K>> implemen
|
|||||||
@Override
|
@Override
|
||||||
public @NotNull CompletableFuture<Boolean> save(@NotNull U user) {
|
public @NotNull CompletableFuture<Boolean> save(@NotNull U user) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
String identifier = serializeKey(user.getKey());
|
String identifier = serializeKey(user.key());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
long s1 = System.currentTimeMillis();
|
long s1 = System.currentTimeMillis();
|
||||||
@@ -195,12 +196,12 @@ public abstract class UserDataManager<K, U extends AbstractUserData<K>> implemen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveAll() {
|
public void saveAll() {
|
||||||
if (getDataCache().isEmpty()) return;
|
if (cache().isEmpty()) return;
|
||||||
for (U u : getDataCache().values()) {
|
for (U u : cache().values()) {
|
||||||
try {
|
try {
|
||||||
saveData(u);
|
saveData(u);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
getPlugin().error("保存用户 " + serializeKey(u.getKey()) + " 数据失败,请检查相关配置!");
|
getPlugin().error("保存用户 " + serializeKey(u.key()) + " 数据失败,请检查相关配置!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,8 +210,8 @@ public abstract class UserDataManager<K, U extends AbstractUserData<K>> implemen
|
|||||||
@Override
|
@Override
|
||||||
public int unloadAll(boolean save) {
|
public int unloadAll(boolean save) {
|
||||||
if (save) saveAll();
|
if (save) saveAll();
|
||||||
int size = getDataCache().size();
|
int size = cache().size();
|
||||||
getDataCache().clear();
|
cache().clear();
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ public interface UserDataRegistry<K, U extends UserData<K>> {
|
|||||||
|
|
||||||
@NotNull Logger getLogger();
|
@NotNull Logger getLogger();
|
||||||
|
|
||||||
|
|
||||||
@NotNull Map<K, U> cache();
|
@NotNull Map<K, U> cache();
|
||||||
|
|
||||||
default String serializeKey(@NotNull K key) {
|
default String serializeKey(@NotNull K key) {
|
||||||
@@ -40,7 +39,6 @@ public interface UserDataRegistry<K, U extends UserData<K>> {
|
|||||||
return load(key, () -> cache);
|
return load(key, () -> cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Unmodifiable
|
@Unmodifiable
|
||||||
default @NotNull Set<U> list() {
|
default @NotNull Set<U> list() {
|
||||||
return ImmutableSet.copyOf(cache().values());
|
return ImmutableSet.copyOf(cache().values());
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.5.13</version>
|
<version>1.5.14</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>base/color</module>
|
<module>base/color</module>
|
||||||
<module>base/utils</module>
|
<module>base/utils</module>
|
||||||
|
|||||||
Reference in New Issue
Block a user