mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2025-12-28 11:19:24 +00:00
Fix users not saving
This commit is contained in:
@@ -36,14 +36,14 @@ public abstract class SQLCommonStorage implements IStorageManager {
|
||||
public SQLCommonStorage(RPGRegions plugin) {
|
||||
this.plugin = plugin;
|
||||
this.cachedAccounts = Caffeine.newBuilder()
|
||||
.maximumSize(1_000)
|
||||
.maximumSize(1_000) // Realistically no server can support higher than this, even Folia
|
||||
.scheduler(Scheduler.systemScheduler())
|
||||
.expireAfterAccess(plugin.getConfig().getInt("settings.storage.cache-expiry-time", 180), TimeUnit.SECONDS)
|
||||
.removalListener((k, v, c) -> {
|
||||
plugin.debug("Removed user from cache, cause: " + c.name());
|
||||
// If the user was manually removed, don't save, let other code handle how it wants
|
||||
if (c == RemovalCause.EXPLICIT) return;
|
||||
removeCachedAccount(((RPGRegionsAccount) v).getUuid());
|
||||
if (v == null || c == RemovalCause.EXPLICIT) return;
|
||||
saveAccount(((RPGRegionsAccount) v));
|
||||
})
|
||||
.buildAsync((key, executor) -> getAccount(key));
|
||||
}
|
||||
|
||||
@@ -35,14 +35,14 @@ public class YamlStorage implements IStorageManager {
|
||||
File dataFile = new File(plugin.getDataFolder() + "/accounts/");
|
||||
dataFile.mkdirs();
|
||||
this.cachedAccounts = Caffeine.newBuilder()
|
||||
.maximumSize(1_000)
|
||||
.maximumSize(1_000) // Realistically no server can support higher than this, even Folia
|
||||
.scheduler(Scheduler.systemScheduler())
|
||||
.expireAfterAccess(plugin.getConfig().getInt("settings.storage.cache-expiry-time", 180), TimeUnit.SECONDS)
|
||||
.removalListener((k, v, c) -> {
|
||||
plugin.debug("Removed user from cache, cause: " + c.name());
|
||||
// If the user was manually removed, don't save, let other code handle how it wants
|
||||
if (c == RemovalCause.EXPLICIT) return;
|
||||
removeCachedAccount(((RPGRegionsAccount) v).getUuid());
|
||||
if (v == null || c == RemovalCause.EXPLICIT) return;
|
||||
saveAccount(((RPGRegionsAccount) v));
|
||||
})
|
||||
.buildAsync((key, executor) -> getAccount(key));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user