diff --git a/common/src/main/java/me/william278/husksync/redis/RedisListener.java b/common/src/main/java/me/william278/husksync/redis/RedisListener.java index 0fd23a57..823195ec 100644 --- a/common/src/main/java/me/william278/husksync/redis/RedisListener.java +++ b/common/src/main/java/me/william278/husksync/redis/RedisListener.java @@ -23,7 +23,18 @@ public abstract class RedisListener { * Creates a new RedisListener and initialises the Redis connection */ public RedisListener() { - jedisPool = new JedisPool(new JedisPoolConfig(), Settings.redisHost, Settings.redisPort); + if (Settings.redisPassword.isEmpty()) { + jedisPool = new JedisPool(new JedisPoolConfig(), + Settings.redisHost, + Settings.redisPort, + 0); + } else { + jedisPool = new JedisPool(new JedisPoolConfig(), + Settings.redisHost, + Settings.redisPort, + 0, + Settings.redisPassword); + } } /** @@ -54,12 +65,8 @@ public abstract class RedisListener { * Start the Redis listener */ public final void listen() { - final String jedisPassword = Settings.redisPassword; new Thread(() -> { try (Jedis jedis = getJedisConnection()) { - if (!jedisPassword.equals("")) { - jedis.auth(jedisPassword); - } if (jedis.isConnected()) { isActiveAndEnabled = true; log(Level.INFO, "Enabled Redis listener successfully!"); diff --git a/common/src/main/java/me/william278/husksync/redis/RedisMessage.java b/common/src/main/java/me/william278/husksync/redis/RedisMessage.java index abac0c0a..8bddd49d 100644 --- a/common/src/main/java/me/william278/husksync/redis/RedisMessage.java +++ b/common/src/main/java/me/william278/husksync/redis/RedisMessage.java @@ -65,11 +65,6 @@ public class RedisMessage { */ public void send() throws IOException { try (Jedis publisher = RedisListener.getJedisConnection()) { - final String jedisPassword = Settings.redisPassword; - publisher.connect(); - if (!jedisPassword.equals("")) { - publisher.auth(jedisPassword); - } publisher.publish(REDIS_CHANNEL, getFullMessage()); } }