feat: close cache
This commit is contained in:
parent
1d366855a2
commit
94bb9ffc18
1 changed files with 10 additions and 1 deletions
|
@ -109,11 +109,20 @@ public class NickoBukkit extends JavaPlugin {
|
|||
@Override
|
||||
public void onDisable() {
|
||||
if (!getDataStore().getStorage().isError()) {
|
||||
getLogger().info("Closing persistence...");
|
||||
nameStore.clearStoredNames();
|
||||
Bukkit.getOnlinePlayers().forEach(player -> dataStore.saveData(player));
|
||||
if (!dataStore.getStorage().getProvider().close()) {
|
||||
getLogger().severe("Failed to close persistence!");
|
||||
} else {
|
||||
getLogger().info("Persistence closed.");
|
||||
}
|
||||
|
||||
if (!dataStore.getCache().getProvider().close()) {
|
||||
if (!dataStore.getCache().getProvider().close()) {
|
||||
getLogger().severe("Failed to close cache!");
|
||||
} else {
|
||||
getLogger().info("Cache closed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue