From a96f9b3201d643d95371f19cebcd77d2a58dd65f Mon Sep 17 00:00:00 2001 From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com> Date: Sat, 26 Dec 2020 14:03:27 +0400 Subject: [PATCH] Update RedisController.java --- .../rediskript/managers/RedisController.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/limework/rediskript/managers/RedisController.java b/src/main/java/net/limework/rediskript/managers/RedisController.java index 5d52d47..65e0ccd 100644 --- a/src/main/java/net/limework/rediskript/managers/RedisController.java +++ b/src/main/java/net/limework/rediskript/managers/RedisController.java @@ -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,7 +80,9 @@ 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..."); - e.printStackTrace(); + if (debugMode) { + e.printStackTrace(); + } } } @@ -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) { - 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("&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(); + plugin.sendErrorLogs(receivedMessage); + } } }