public abstract class UserDataManager<K,U extends UserData<K>>
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
protected @NotNull java.util.Map<K,U> |
dataCache |
protected @NotNull java.util.concurrent.ExecutorService |
executor |
protected @NotNull EasyPlugin |
plugin |
构造器和说明 |
---|
UserDataManager(@NotNull EasyPlugin plugin) |
UserDataManager(@NotNull EasyPlugin plugin,
@NotNull java.util.concurrent.ExecutorService executor) |
UserDataManager(@NotNull EasyPlugin plugin,
@NotNull java.util.concurrent.ExecutorService executor,
@NotNull java.util.Map<K,U> cacheMap) |
限定符和类型 | 方法和说明 |
---|---|
abstract U |
emptyUser(K key) |
U |
errorUser(K key) |
U |
get(K key) |
@NotNull java.util.Map<K,U> |
getDataCache() |
protected @NotNull java.util.logging.Logger |
getLogger() |
U |
getNullable(K key) |
@NotNull java.util.Optional<U> |
getOptional(K key) |
protected @NotNull EasyPlugin |
getPlugin() |
@Unmodifiable @NotNull java.util.Set<U> |
list() |
@NotNull java.util.concurrent.CompletableFuture<U> |
load(K key) |
@NotNull java.util.concurrent.CompletableFuture<U> |
load(K key,
boolean cache) |
@NotNull java.util.concurrent.CompletableFuture<U> |
load(K key,
@NotNull java.util.function.Supplier<java.lang.Boolean> cacheCondition) |
protected abstract U |
loadData(K key) |
<T> @NotNull java.util.concurrent.CompletableFuture<java.util.Map<K,U>> |
loadGroup(@NotNull java.util.Collection<? extends T> users,
@NotNull java.util.function.Function<? super T,? extends K> function,
@NotNull java.util.function.Predicate<T> cacheCondition) |
@NotNull java.util.concurrent.CompletableFuture<java.util.Map<K,U>> |
loadGroup(@NotNull java.util.Collection<K> allKeys) |
@NotNull java.util.concurrent.CompletableFuture<java.util.Map<K,U>> |
loadGroup(@NotNull java.util.Collection<K> allKeys,
@NotNull java.util.function.Predicate<K> cacheCondition) |
@NotNull java.util.concurrent.CompletableFuture<java.util.Map<K,U>> |
loadOnline(@NotNull java.util.function.Function<org.bukkit.entity.Player,? extends K> function) |
@NotNull java.util.concurrent.CompletableFuture<java.lang.Boolean> |
modify(K key,
@NotNull java.util.function.Consumer<U> consumer) |
<V> @NotNull java.util.concurrent.CompletableFuture<V> |
peek(K key,
@NotNull java.util.function.Function<U,V> function) |
@NotNull java.util.concurrent.CompletableFuture<java.lang.Boolean> |
save(U user) |
void |
saveAll() |
protected abstract void |
saveData(U data) |
java.lang.String |
serializeKey(K key) |
void |
shutdown() |
@NotNull java.util.concurrent.CompletableFuture<java.lang.Boolean> |
unload(K key) |
@NotNull java.util.concurrent.CompletableFuture<java.lang.Boolean> |
unload(K key,
boolean save) |
int |
unloadAll(boolean save) |
@NotNull protected final @NotNull EasyPlugin plugin
@NotNull protected final @NotNull java.util.concurrent.ExecutorService executor
public UserDataManager(@NotNull @NotNull EasyPlugin plugin)
public UserDataManager(@NotNull @NotNull EasyPlugin plugin, @NotNull @NotNull java.util.concurrent.ExecutorService executor)
public UserDataManager(@NotNull @NotNull EasyPlugin plugin, @NotNull @NotNull java.util.concurrent.ExecutorService executor, @NotNull @NotNull java.util.Map<K,U> cacheMap)
public void shutdown()
@NotNull protected @NotNull EasyPlugin getPlugin()
@NotNull protected @NotNull java.util.logging.Logger getLogger()
public java.lang.String serializeKey(@NotNull K key)
@Nullable protected abstract U loadData(@NotNull K key) throws java.lang.Exception
java.lang.Exception
protected abstract void saveData(@NotNull U data) throws java.lang.Exception
java.lang.Exception
@NotNull public @NotNull java.util.concurrent.CompletableFuture<U> load(@NotNull K key, boolean cache)
@NotNull public @Unmodifiable @NotNull java.util.Set<U> list()
@NotNull public @NotNull java.util.concurrent.CompletableFuture<U> load(@NotNull K key, @NotNull @NotNull java.util.function.Supplier<java.lang.Boolean> cacheCondition)
@NotNull public @NotNull java.util.concurrent.CompletableFuture<java.lang.Boolean> save(@NotNull U user)
@NotNull public @NotNull java.util.concurrent.CompletableFuture<java.lang.Boolean> unload(@NotNull K key)
@NotNull public @NotNull java.util.concurrent.CompletableFuture<java.lang.Boolean> unload(@NotNull K key, boolean save)
@NotNull public @NotNull java.util.concurrent.CompletableFuture<java.lang.Boolean> modify(@NotNull K key, @NotNull @NotNull java.util.function.Consumer<U> consumer)
@NotNull public <V> @NotNull java.util.concurrent.CompletableFuture<V> peek(@NotNull K key, @NotNull @NotNull java.util.function.Function<U,V> function)
@NotNull public @NotNull java.util.concurrent.CompletableFuture<java.util.Map<K,U>> loadOnline(@NotNull @NotNull java.util.function.Function<org.bukkit.entity.Player,? extends K> function)
@NotNull public <T> @NotNull java.util.concurrent.CompletableFuture<java.util.Map<K,U>> loadGroup(@NotNull @NotNull java.util.Collection<? extends T> users, @NotNull @NotNull java.util.function.Function<? super T,? extends K> function, @NotNull @NotNull java.util.function.Predicate<T> cacheCondition)
@NotNull public @NotNull java.util.concurrent.CompletableFuture<java.util.Map<K,U>> loadGroup(@NotNull @NotNull java.util.Collection<K> allKeys, @NotNull @NotNull java.util.function.Predicate<K> cacheCondition)
@NotNull public @NotNull java.util.concurrent.CompletableFuture<java.util.Map<K,U>> loadGroup(@NotNull @NotNull java.util.Collection<K> allKeys)
public void saveAll()
public int unloadAll(boolean save)
Copyright © 2024. All rights reserved.