From 7f8cbc3bc018b94929aeccad87be27cc304feaeb Mon Sep 17 00:00:00 2001 From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com> Date: Tue, 28 Jul 2020 10:53:42 +0400 Subject: [PATCH] added protection to kill current working sub --- pom.xml | 2 +- .../java/net/limework/core/managers/RedisManager.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2680196..5287a77 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.limework.core LimeworkSpigotCore - 1.0.3-SNAPSHOT + 1.0.3-fix1-SNAPSHOT jar diff --git a/src/main/java/net/limework/core/managers/RedisManager.java b/src/main/java/net/limework/core/managers/RedisManager.java index b79ec00..c10f4b4 100644 --- a/src/main/java/net/limework/core/managers/RedisManager.java +++ b/src/main/java/net/limework/core/managers/RedisManager.java @@ -179,6 +179,14 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable, Command , "&c&lYou can not execute this command!!!!!!"))); return true; } + try { + if (this.subscribeJedis != null) { + this.unsubscribe(); + this.subscribeJedis.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } start(); return false; }