new ConnectionController! #11

Merged
ham1255 merged 4 commits from patch-1 into master 2020-12-26 10:04:19 +00:00
Showing only changes of commit a96f9b3201 - Show all commits

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