fix: revert cache close
This commit is contained in:
parent
94bb9ffc18
commit
6633ac94a8
4 changed files with 13 additions and 13 deletions
|
@ -116,14 +116,6 @@ public class NickoBukkit extends JavaPlugin {
|
|||
} 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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getLogger().info("Nicko (Bukkit) has been disabled.");
|
||||
|
|
|
@ -4,14 +4,15 @@ import xyz.atnrch.nicko.gui.items.common.GoBackItem;
|
|||
import xyz.atnrch.nicko.gui.items.settings.BungeeCordCyclingItem;
|
||||
import xyz.atnrch.nicko.gui.items.settings.LanguageCyclingItem;
|
||||
import org.bukkit.entity.Player;
|
||||
import xyz.atnrch.nicko.i18n.I18N;
|
||||
import xyz.atnrch.nicko.i18n.I18NDict;
|
||||
import xyz.xenondevs.invui.gui.Gui;
|
||||
import xyz.xenondevs.invui.window.Window;
|
||||
|
||||
public class SettingsGUI {
|
||||
public static final String TITLE = "Nicko > Settings";
|
||||
|
||||
private final Player player;
|
||||
private final Gui gui;
|
||||
private final String title;
|
||||
|
||||
public SettingsGUI(Player player) {
|
||||
final String[] dynamicStructure = new String[]{
|
||||
|
@ -23,6 +24,9 @@ public class SettingsGUI {
|
|||
// TODO: 3/6/23 Replace when Redis is not enabled
|
||||
dynamicStructure[1] = dynamicStructure[1].replace("T", "U");
|
||||
|
||||
final I18N i18n = new I18N(player);
|
||||
this.title = i18n.translatePrefixless(I18NDict.GUI.Settings.TITLE);
|
||||
|
||||
final HomeGUI parent = new HomeGUI(player);
|
||||
final LanguageCyclingItem languageItem = new LanguageCyclingItem(player);
|
||||
final BungeeCordCyclingItem bungeeCordItem = new BungeeCordCyclingItem(player);
|
||||
|
@ -38,6 +42,6 @@ public class SettingsGUI {
|
|||
}
|
||||
|
||||
public void open() {
|
||||
Window.single().setGui(gui).setTitle(TITLE).open(player);
|
||||
Window.single().setGui(gui).setTitle(title).open(player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ public class MapCacheProvider implements CacheProvider {
|
|||
|
||||
@Override
|
||||
public boolean close() {
|
||||
profiles = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package xyz.atnrch.nicko.storage.redis;
|
||||
|
||||
import redis.clients.jedis.exceptions.JedisConnectionException;
|
||||
import xyz.atnrch.nicko.config.Configuration;
|
||||
import xyz.atnrch.nicko.config.DataSourceConfiguration;
|
||||
import xyz.atnrch.nicko.storage.CacheProvider;
|
||||
|
@ -18,7 +19,11 @@ public class RedisCacheProvider implements CacheProvider {
|
|||
public boolean init() {
|
||||
final DataSourceConfiguration redisConfiguration = configuration.getRedisConfiguration();
|
||||
pool = new JedisPool(redisConfiguration.getAddress(), redisConfiguration.getPort());
|
||||
return !pool.isClosed() && pool.getResource() != null;
|
||||
try {
|
||||
return !pool.isClosed() && pool.getResource() != null;
|
||||
} catch (JedisConnectionException exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue