Better 1.8 support & cleanup

This commit is contained in:
Govindass 2020-10-23 17:21:32 +03:00
parent 31db51fce6
commit efab085c47
2 changed files with 7 additions and 7 deletions

View File

@ -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;
}
}

View File

@ -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<String> 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();