Update RedisController.java

This commit is contained in:
mohammed jasem alaajel 2020-12-26 14:03:27 +04:00
parent bfb8ebc862
commit a96f9b3201

View File

@ -35,6 +35,7 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
private final AtomicBoolean isConnectionBroken;
private final AtomicBoolean isConnecting;
private final RediSkript plugin;
private final boolean debugMode = false; //todo: will be later in the config in future release.
private final BukkitTask ConnectionTask;
@ -79,9 +80,11 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
isConnecting.set(false);
isConnectionBroken.set(true);
plugin.sendLogs("Connection has &kFAILED &cor Unable to connect to redis retrying to make connection...");
if (debugMode) {
e.printStackTrace();
}
}
}
public void shutdown() {
ConnectionTask.cancel();
@ -89,6 +92,9 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
this.unsubscribe();
} catch (Exception e) {
plugin.sendErrorLogs("Something went wrong during unsubscribing...");
if (debugMode) {
e.printStackTrace();
}
}
jedisPool.close();
@ -170,9 +176,11 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
}
}
} catch (Exception e) {
plugin.sendErrorLogs("&cI got a message that was empty from channel " + channelString + " please check your code that you used to send the message. Message content:");
if (debugMode) {
e.printStackTrace();
Bukkit.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&cI got a message that was empty from channel " + channelString + " please check your code that you used to send the message. Message content:"));
Bukkit.getLogger().warning(receivedMessage);
plugin.sendErrorLogs(receivedMessage);
}
}
}