1
0
Fork 0
mirror of https://github.com/xHyroM/lighteco.git synced 2024-11-10 01:18:07 +01:00

feat: user management, currency management

This commit is contained in:
xHyroM 2023-08-02 21:01:30 +02:00
parent 7757558442
commit 9a0b64b371
No known key found for this signature in database
GPG key ID: BE0423F386C436AA
29 changed files with 544 additions and 63 deletions

View file

@ -1,5 +1,6 @@
package dev.xhyrom.lighteco.api;
import dev.xhyrom.lighteco.api.managers.CurrencyManager;
import dev.xhyrom.lighteco.api.managers.UserManager;
import dev.xhyrom.lighteco.api.platform.Platform;
import dev.xhyrom.lighteco.api.platform.PlayerAdapter;
@ -16,5 +17,7 @@ public interface LightEco {
@NonNull UserManager getUserManager();
@NonNull CurrencyManager getCurrencyManager();
<T> @NonNull PlayerAdapter<T> getPlayerAdapter(@NonNull Class<T> playerClass);
}

View file

@ -0,0 +1,7 @@
package dev.xhyrom.lighteco.api.exceptions;
public class NotImplementedException extends RuntimeException {
public NotImplementedException() {
super("This feature is not implemented yet!");
}
}

View file

@ -0,0 +1,13 @@
package dev.xhyrom.lighteco.api.managers;
import dev.xhyrom.lighteco.api.model.currency.Currency;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection;
public interface CurrencyManager {
@NonNull Collection<Currency<?>> getRegisteredCurrencies();
Currency<?> getCurrency(@NonNull String identifier);
void registerCurrency(@NonNull Currency<?> currency);
}

View file

@ -1,17 +1,28 @@
package dev.xhyrom.lighteco.api.model.currency;
public interface Currency<T> {
String getIdentifier();
import dev.xhyrom.lighteco.api.exceptions.NotImplementedException;
import dev.xhyrom.lighteco.api.model.user.User;
import lombok.Getter;
import java.util.List;
public abstract class Currency<T> {
@Getter
private final Class<T> valueType;
public Currency(Class<T> valueType) {
this.valueType = valueType;
}
public abstract String getIdentifier();
/**
* Get the type of the currency, either {@link Type#EXCLUSIVE} or {@link Type#GLOBAL}
* Get the type of the currency, either {@link Type#LOCAL} or {@link Type#GLOBAL}
*
* @see Type
* @return The type of the currency
*/
Type getType();
public abstract Type getType();
boolean isPayable();
public abstract boolean isPayable();
/**
* Calculate the tax for the given amount
@ -20,18 +31,23 @@ public interface Currency<T> {
* @param amount The amount to calculate the tax for
* @return The tax
*/
default double calculateTax(T amount) {
public double calculateTax(T amount) {
return 0;
};
// Implemented in common module
public List<User> getTopUsers(int length) {
throw new NotImplementedException();
}
/**
* Represents the type of currency
*/
enum Type {
public enum Type {
/**
* A currency that is only available on a single server
*/
EXCLUSIVE,
LOCAL,
/**
* A currency that is available on all servers (proxy)
*/

View file

@ -1,5 +1,6 @@
package dev.xhyrom.lighteco.api.model.user;
import dev.xhyrom.lighteco.api.model.currency.Currency;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
@ -18,4 +19,12 @@ public interface User {
* @return the username
*/
@NonNull String getUsername();
/**
* Get the balance of this user for the specified currency.
*
* @param currency the currency
* @return the balance
*/
<T> T getBalance(@NonNull Currency<T> currency);
}

View file

@ -19,5 +19,13 @@ public interface Platform {
public String getName() {
return displayName;
}
public boolean isLocal() {
return this == BUKKIT;
}
public boolean isProxy() {
return this == VELOCITY || this == BUNGEECORD;
}
}
}

View file

@ -1,12 +1,15 @@
package dev.xhyrom.lighteco.bukkit;
import dev.xhyrom.lighteco.bukkit.test.TestPlugin;
import org.bukkit.plugin.java.JavaPlugin;
public class BukkitLightEcoLoader extends JavaPlugin {
private BukkitLightEcoPlugin plugin = new BukkitLightEcoPlugin();
private final BukkitLightEcoPlugin plugin = new BukkitLightEcoPlugin();
@Override
public void onEnable() {
plugin.enable();
new TestPlugin(this);
}
}

View file

@ -1,23 +1,29 @@
package dev.xhyrom.lighteco.bukkit;
import dev.xhyrom.lighteco.api.managers.ContextManager;
import dev.xhyrom.lighteco.api.managers.CurrencyManager;
import dev.xhyrom.lighteco.api.managers.UserManager;
import dev.xhyrom.lighteco.api.platform.Platform;
import dev.xhyrom.lighteco.common.api.impl.ApiCurrencyManager;
import dev.xhyrom.lighteco.common.managers.currency.StandardCurrencyManager;
import dev.xhyrom.lighteco.common.plugin.AbstractLightEcoPlugin;
import dev.xhyrom.lighteco.common.managers.StandardUserManager;
import dev.xhyrom.lighteco.common.managers.user.StandardUserManager;
import lombok.Getter;
import org.bukkit.entity.Player;
import org.checkerframework.checker.nullness.qual.NonNull;
public class BukkitLightEcoPlugin extends AbstractLightEcoPlugin {
@Getter
private UserManager userManager;
private StandardUserManager userManager;
@Getter
private StandardCurrencyManager currencyManager;
@Getter
private ContextManager<Player> contextManager;
@Override
public void setupManagers() {
this.userManager = new StandardUserManager(this);
this.currencyManager = new StandardCurrencyManager(this);
this.contextManager = new BukkitContextManager();
}

View file

@ -0,0 +1,24 @@
package dev.xhyrom.lighteco.bukkit.test;
import dev.xhyrom.lighteco.api.model.currency.Currency;
public class TestCurrency extends Currency<Integer> {
public TestCurrency() {
super(Integer.class);
}
@Override
public String getIdentifier() {
return "test";
}
@Override
public Type getType() {
return Type.LOCAL;
}
@Override
public boolean isPayable() {
return true;
}
}

View file

@ -0,0 +1,25 @@
package dev.xhyrom.lighteco.bukkit.test;
import dev.xhyrom.lighteco.api.LightEcoProvider;
import org.bukkit.plugin.java.JavaPlugin;
public class TestPlugin {
private final JavaPlugin plugin;
public TestPlugin(JavaPlugin plugin) {
this.plugin = plugin;
plugin.getLogger().info("TestPlugin loaded!");
LightEcoProvider.get().getCurrencyManager().registerCurrency(new TestCurrency());
plugin.getLogger().info("TestCurrency registered!");
LightEcoProvider.get().getCurrencyManager().getRegisteredCurrencies().forEach(currency -> {
plugin.getLogger().info("Currency: " + currency.getIdentifier() + " (" + currency.getType() + ", " + currency.getValueType() + ", " + currency.isPayable() + ")");
currency.getTopUsers(5).forEach(user -> {
plugin.getLogger().info("User: " + user.getUniqueId() + " (" + user.getUsername() + ")");
});
});
}
}

View file

@ -1,7 +1,7 @@
name: ${name}
description: ${description}
version: ${version}
main: dev.xhyrom.lighteco.bukkit.BukkitLightEcoPlugin
main: dev.xhyrom.lighteco.bukkit.BukkitLightEcoLoader
author: ${author}
api-version: 1.20

View file

@ -1,9 +1,12 @@
package dev.xhyrom.lighteco.common.api;
import dev.xhyrom.lighteco.api.LightEco;
import dev.xhyrom.lighteco.api.managers.CurrencyManager;
import dev.xhyrom.lighteco.api.managers.UserManager;
import dev.xhyrom.lighteco.api.platform.Platform;
import dev.xhyrom.lighteco.api.platform.PlayerAdapter;
import dev.xhyrom.lighteco.common.api.impl.ApiCurrencyManager;
import dev.xhyrom.lighteco.common.api.impl.ApiUserManager;
import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin;
import dev.xhyrom.lighteco.common.api.impl.ApiPlatform;
import dev.xhyrom.lighteco.common.api.impl.ApiPlayerAdapter;
@ -13,13 +16,17 @@ public class LightEcoApi implements LightEco {
private final LightEcoPlugin plugin;
private final Platform platform;
private final UserManager userManager;
private final CurrencyManager currencyManager;
private final PlayerAdapter<?> playerAdapter;
public LightEcoApi(LightEcoPlugin plugin) {
this.plugin = plugin;
this.platform = new ApiPlatform(plugin);
this.playerAdapter = new ApiPlayerAdapter<>(plugin.getUserManager(), plugin.getContextManager());
this.userManager = new ApiUserManager(plugin, plugin.getUserManager());
this.currencyManager = new ApiCurrencyManager(plugin, plugin.getCurrencyManager());
this.playerAdapter = new ApiPlayerAdapter<>(userManager, plugin.getContextManager());
}
@Override
@ -29,7 +36,12 @@ public class LightEcoApi implements LightEco {
@Override
public @NonNull UserManager getUserManager() {
return this.plugin.getUserManager();
return this.userManager;
}
@Override
public @NonNull CurrencyManager getCurrencyManager() {
return this.currencyManager;
}
@Override

View file

@ -0,0 +1,13 @@
package dev.xhyrom.lighteco.common.api.impl;
import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin;
public abstract class ApiAbstractManager<H> {
protected final LightEcoPlugin plugin;
protected final H handler;
protected ApiAbstractManager(LightEcoPlugin plugin, H handler) {
this.plugin = plugin;
this.handler = handler;
}
}

View file

@ -0,0 +1,35 @@
package dev.xhyrom.lighteco.common.api.impl;
import dev.xhyrom.lighteco.api.model.currency.Currency;
import dev.xhyrom.lighteco.api.model.user.User;
import java.util.List;
public class ApiCurrency extends Currency {
private final dev.xhyrom.lighteco.common.model.currency.Currency<?> handler;
public ApiCurrency(dev.xhyrom.lighteco.common.model.currency.Currency<?> handler) {
super(handler.getValueType());
this.handler = handler;
}
public String getIdentifier() {
return this.handler.getIdentifier();
}
public Currency.Type getType() {
return this.handler.getType();
}
public boolean isPayable() {
return this.handler.isPayable();
}
public List<User> getTopUsers(int length) {
return this.handler.getTopUsers(length)
.stream()
.map(ApiUserManager::wrap)
.toList();
}
}

View file

@ -0,0 +1,37 @@
package dev.xhyrom.lighteco.common.api.impl;
import dev.xhyrom.lighteco.api.managers.CurrencyManager;
import dev.xhyrom.lighteco.api.model.currency.Currency;
import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection;
import java.util.stream.Collectors;
public class ApiCurrencyManager extends ApiAbstractManager<dev.xhyrom.lighteco.common.managers.currency.CurrencyManager> implements CurrencyManager {
public ApiCurrencyManager(LightEcoPlugin plugin, dev.xhyrom.lighteco.common.managers.currency.CurrencyManager handler) {
super(plugin, handler);
}
private Currency<?> wrap(dev.xhyrom.lighteco.common.model.currency.Currency<?> handler) {
return new ApiCurrency(handler);
}
@Override
public @NonNull Collection<Currency<?>> getRegisteredCurrencies() {
return this.handler.values()
.stream().map(this::wrap)
.collect(Collectors.toList());
}
@Override
public Currency<?> getCurrency(@NonNull String identifier) {
return wrap(this.handler.getIfLoaded(identifier));
}
@Override
public void registerCurrency(@NonNull Currency<?> currency) {
dev.xhyrom.lighteco.common.model.currency.Currency<?> internal = new dev.xhyrom.lighteco.common.model.currency.Currency<>(plugin, currency);
this.handler.registerCurrency(internal);
}
}

View file

@ -0,0 +1,30 @@
package dev.xhyrom.lighteco.common.api.impl;
import dev.xhyrom.lighteco.api.model.currency.Currency;
import dev.xhyrom.lighteco.api.model.user.User;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
public class ApiUser implements User {
private final dev.xhyrom.lighteco.common.model.user.User handler;
public ApiUser(dev.xhyrom.lighteco.common.model.user.User handler) {
this.handler = handler;
}
@Override
public @NonNull UUID getUniqueId() {
return this.handler.getUniqueId();
}
@Override
public @NonNull String getUsername() {
return null;
}
@Override
public <T> T getBalance(@NonNull Currency<T> currency) {
return this.handler.getBalance(currency);
}
}

View file

@ -0,0 +1,40 @@
package dev.xhyrom.lighteco.common.api.impl;
import dev.xhyrom.lighteco.api.managers.UserManager;
import dev.xhyrom.lighteco.api.model.user.User;
import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
public class ApiUserManager extends ApiAbstractManager<dev.xhyrom.lighteco.common.managers.user.UserManager> implements UserManager {
public ApiUserManager(LightEcoPlugin plugin, dev.xhyrom.lighteco.common.managers.user.UserManager handler) {
super(plugin, handler);
}
public static User wrap(dev.xhyrom.lighteco.common.model.user.User handler) {
return handler.getProxy();
}
@Override
public @NonNull CompletableFuture<User> loadUser(@NonNull UUID uniqueId) {
return this.plugin.getStorage().loadUser(uniqueId);
}
@Override
public @NonNull CompletableFuture<Void> saveUser(@NonNull User user) {
return this.plugin.getStorage().saveUser(user);
}
@Override
public @Nullable User getUser(@NonNull UUID uniqueId) {
return wrap(this.handler.getIfLoaded(uniqueId));
}
@Override
public boolean isLoaded(@NonNull UUID uniqueId) {
return this.handler.isLoaded(uniqueId);
}
}

View file

@ -0,0 +1,44 @@
package dev.xhyrom.lighteco.common.managers;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
public abstract class AbstractManager<I, T> implements Manager<I, T> {
public final Map<I, T> map = new HashMap<>();
@Override
public Collection<I> keys() {
return this.map.keySet();
}
@Override
public Collection<T> values() {
return this.map.values();
}
@Override
public T getOrMake(I identifier) {
return this.map.getOrDefault(identifier, this.apply(identifier));
}
@Override
public T getIfLoaded(I identifier) {
return this.map.get(identifier);
}
@Override
public boolean isLoaded(I identifier) {
return this.map.containsKey(identifier);
}
@Override
public void unload(I identifier) {
this.map.remove(identifier);
}
@Override
public void unload(Collection<I> identifiers) {
identifiers.forEach(this::unload);
}
}

View file

@ -0,0 +1,21 @@
package dev.xhyrom.lighteco.common.managers;
import java.util.Collection;
import java.util.concurrent.CompletableFuture;
public interface Manager<I, T> {
T apply(I identifier);
Collection<I> keys();
Collection<T> values();
T getOrMake(I identifier);
T getIfLoaded(I identifier);
boolean isLoaded(I identifier);
void unload(I identifier);
void unload(Collection<I> identifiers);
}

View file

@ -1,41 +0,0 @@
package dev.xhyrom.lighteco.common.managers;
import dev.xhyrom.lighteco.api.model.user.User;
import dev.xhyrom.lighteco.api.managers.UserManager;
import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
public class StandardUserManager implements UserManager {
private final LightEcoPlugin plugin;
public StandardUserManager(LightEcoPlugin plugin) {
this.plugin = plugin;
}
public User apply(UUID uniqueId) {
return new dev.xhyrom.lighteco.common.model.user.User(uniqueId);
}
@Override
public @NonNull CompletableFuture<User> loadUser(@NonNull UUID uniqueId) {
return null;
}
@Override
public @NonNull CompletableFuture<Void> saveUser(User user) {
return null;
}
@Override
public @Nullable User getUser(@NonNull UUID uniqueId) {
return null;
}
@Override
public boolean isLoaded(@NonNull UUID uniqueId) {
return false;
}
}

View file

@ -0,0 +1,13 @@
package dev.xhyrom.lighteco.common.managers.currency;
import dev.xhyrom.lighteco.common.managers.Manager;
import dev.xhyrom.lighteco.common.model.currency.Currency;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection;
public interface CurrencyManager extends Manager<String, Currency<?>> {
@NonNull Collection<Currency<?>> getRegisteredCurrencies();
void registerCurrency(@NonNull Currency<?> currency);
}

View file

@ -0,0 +1,47 @@
package dev.xhyrom.lighteco.common.managers.currency;
import dev.xhyrom.lighteco.common.managers.AbstractManager;
import dev.xhyrom.lighteco.common.model.currency.Currency;
import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection;
import static dev.xhyrom.lighteco.api.model.currency.Currency.Type;
public class StandardCurrencyManager extends AbstractManager<String, Currency<?>> implements CurrencyManager {
private final LightEcoPlugin plugin;
public StandardCurrencyManager(LightEcoPlugin plugin) {
this.plugin = plugin;
}
@Override
public Currency<?> apply(String identifier) {
return null;
}
@Override
public Currency<?> getOrMake(String identifier) {
throw new UnsupportedOperationException();
}
@Override
public @NonNull Collection<Currency<?>> getRegisteredCurrencies() {
return this.values();
}
@Override
public void registerCurrency(@NonNull Currency<?> currency) {
if (currency.getType() == Type.GLOBAL && this.plugin.getPlatformType().isLocal())
throw new IllegalArgumentException("Cannot register global currency on local platform");
if (currency.getType() == Type.LOCAL && this.plugin.getPlatformType().isProxy())
throw new IllegalArgumentException("Cannot register local currency on proxy platform");
if (this.isLoaded(currency.getIdentifier()))
throw new IllegalArgumentException("Currency with identifier " + currency.getIdentifier() + " already registered");
this.map.put(currency.getIdentifier(), currency);
}
}

View file

@ -0,0 +1,39 @@
package dev.xhyrom.lighteco.common.managers.user;
import dev.xhyrom.lighteco.common.managers.AbstractManager;
import dev.xhyrom.lighteco.common.model.user.User;
import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
public class StandardUserManager extends AbstractManager<UUID, User> implements UserManager {
private final LightEcoPlugin plugin;
public StandardUserManager(LightEcoPlugin plugin) {
this.plugin = plugin;
}
@Override
public User apply(UUID uniqueId) {
return new User(this.plugin, uniqueId);
}
@Override
public CompletableFuture<Void> load() {
Set<UUID> uniqueIds = new HashSet<>(keys());
// TODO: Add all players lol
//uniqueIds.addAll(this.plugin.getBootstrap().getOnlinePlayers());
return uniqueIds.stream()
.map(id -> this.plugin.getStorage().loadUser(id))
.collect(CompletableFuture::allOf, (future, userFuture) -> future.join(), (future, userFuture) -> future.join());
}
@Override
public void invalidateCaches() {
}
}

View file

@ -0,0 +1,13 @@
package dev.xhyrom.lighteco.common.managers.user;
import dev.xhyrom.lighteco.common.managers.Manager;
import dev.xhyrom.lighteco.common.model.user.User;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
public interface UserManager extends Manager<UUID, User> {
CompletableFuture<Void> load();
void invalidateCaches();
}

View file

@ -0,0 +1,44 @@
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.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class Currency<T> {
private final LightEcoPlugin plugin;
@Getter
private final dev.xhyrom.lighteco.api.model.currency.Currency<T> proxy;
public Currency(LightEcoPlugin plugin, dev.xhyrom.lighteco.api.model.currency.Currency<T> proxy) {
this.plugin = plugin;
this.proxy = proxy;
}
public String getIdentifier() {
return proxy.getIdentifier();
}
public dev.xhyrom.lighteco.api.model.currency.Currency.Type getType() {
return proxy.getType();
}
public Class<T> getValueType() {
return proxy.getValueType();
}
public boolean isPayable() {
return proxy.isPayable();
}
public List<User> getTopUsers(int length) {
List<User> users = new ArrayList<>();
users.add(new User(plugin, new UUID(0, 0)));
return users;
}
}

View file

@ -1,20 +1,30 @@
package dev.xhyrom.lighteco.common.model.user;
import dev.xhyrom.lighteco.api.model.currency.Currency;
import dev.xhyrom.lighteco.common.api.impl.ApiUser;
import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin;
import lombok.Getter;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
public class User implements dev.xhyrom.lighteco.api.model.user.User {
public class User {
@Getter
private final LightEcoPlugin plugin;
@Getter
private final ApiUser proxy = new ApiUser(this);
@Getter
private final UUID uniqueId;
public User(UUID uniqueId) {
public User(LightEcoPlugin plugin, UUID uniqueId) {
this.plugin = plugin;
this.uniqueId = uniqueId;
}
@Override
public @NonNull String getUsername() {
// TODO: finish
public <T> T getBalance(@NonNull Currency<T> currency) {
this.plugin.getCurrencyManager().getIfLoaded(currency.getIdentifier());
return null;
}
}

View file

@ -1,5 +1,7 @@
package dev.xhyrom.lighteco.common.plugin;
import dev.xhyrom.lighteco.api.LightEcoProvider;
import dev.xhyrom.lighteco.common.api.LightEcoApi;
import dev.xhyrom.lighteco.common.storage.Storage;
import dev.xhyrom.lighteco.common.storage.StorageFactory;
import lombok.Getter;
@ -7,11 +9,17 @@ import lombok.Getter;
public abstract class AbstractLightEcoPlugin implements LightEcoPlugin {
@Getter
private Storage storage;
private LightEcoApi api;
public final void enable() {
StorageFactory factory = new StorageFactory(this);
this.storage = factory.get();
this.setupManagers();
this.api = new LightEcoApi(this);
LightEcoProvider.set(this.api);
}
protected abstract void setupManagers();

View file

@ -1,8 +1,9 @@
package dev.xhyrom.lighteco.common.plugin;
import dev.xhyrom.lighteco.api.managers.ContextManager;
import dev.xhyrom.lighteco.api.managers.UserManager;
import dev.xhyrom.lighteco.api.platform.Platform;
import dev.xhyrom.lighteco.common.managers.currency.CurrencyManager;
import dev.xhyrom.lighteco.common.managers.user.UserManager;
import dev.xhyrom.lighteco.common.storage.Storage;
import org.checkerframework.checker.nullness.qual.NonNull;
@ -10,6 +11,7 @@ public interface LightEcoPlugin {
Platform.@NonNull Type getPlatformType();
@NonNull UserManager getUserManager();
@NonNull CurrencyManager getCurrencyManager();
@NonNull ContextManager<?> getContextManager();
@NonNull Storage getStorage();

View file

@ -8,7 +8,7 @@ import java.util.HashMap;
import java.util.UUID;
public class MemoryStorageProvider implements StorageProvider {
private HashMap<UUID, User> users = new HashMap<>();
private final HashMap<UUID, User> userDatabase = new HashMap<>();
@Override
public @NonNull String[] getIdentifiers() {
@ -17,11 +17,11 @@ public class MemoryStorageProvider implements StorageProvider {
@Override
public @NonNull User loadUser(@NonNull UUID uniqueId) {
return users.get(uniqueId);
return userDatabase.get(uniqueId);
}
@Override
public void saveUser(@NonNull User user) {
users.put(user.getUniqueId(), user);
userDatabase.put(user.getUniqueId(), user);
}
}