From cfc8ceb2eceda924e55812d701a8c5af84de50cb Mon Sep 17 00:00:00 2001 From: Govindas Date: Fri, 23 Oct 2020 17:21:32 +0300 Subject: [PATCH] Better 1.8 support & cleanup --- .../java/net/limework/core/commands/ReloadRedis.java | 10 ++++++---- .../java/net/limework/core/managers/RedisManager.java | 4 +--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/limework/core/commands/ReloadRedis.java b/src/main/java/net/limework/core/commands/ReloadRedis.java index a66ac7f..feea213 100644 --- a/src/main/java/net/limework/core/commands/ReloadRedis.java +++ b/src/main/java/net/limework/core/commands/ReloadRedis.java @@ -1,7 +1,7 @@ package net.limework.core.commands; import net.limework.core.RediSkript; -import net.md_5.bungee.api.chat.TextComponent; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -16,13 +16,15 @@ public class ReloadRedis implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (sender instanceof Player) { - sender.sendMessage(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&' + //not using bungee TextComponent because it is not present in 1.8.8 + sender.sendMessage((ChatColor.translateAlternateColorCodes('&' , "&2[&aRediSkript&a] &cThis command can only be executed in console."))); return true; } plugin.getRm().reload(); - sender.sendMessage(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&' - , "&2[&aRediSkript&a] &eReloaded! Please note that this command is not guaranteed to work correctly, if you face any problem caused by this command, please report it on github.com/Limework/RediSkript/issues"))); + //not sending to sender, because this command can only be executed via console + Bukkit.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&2[&aRediSkript&a] &eReloaded via command! Please note that this command is not guaranteed to work correctly, if you face any problem caused by this command, please report it on github.com/Limework/RediSkript/issues")); + return false; } } diff --git a/src/main/java/net/limework/core/managers/RedisManager.java b/src/main/java/net/limework/core/managers/RedisManager.java index f6e3e2a..5952e60 100644 --- a/src/main/java/net/limework/core/managers/RedisManager.java +++ b/src/main/java/net/limework/core/managers/RedisManager.java @@ -27,14 +27,11 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable { private JedisPool jedisPool; private ExecutorService RedisService; - private AtomicBoolean isKilled = new AtomicBoolean(); - //sub private BinaryJedis subscribeJedis; private List channels; private AtomicBoolean isShuttingDown = new AtomicBoolean(false); - private AtomicBoolean isOnline = new AtomicBoolean(); private Encryption encryption; @@ -146,6 +143,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable { if (this.subscribeJedis != null) { this.unsubscribe(); this.subscribeJedis.close(); + this.subscribeJedis.shutdown(); } this.RedisService.shutdown();