diff --git a/bukkit/src/main/resources/config.yml b/bukkit/src/main/resources/config.yml index eb8d1c57a..a4dd153e7 100644 --- a/bukkit/src/main/resources/config.yml +++ b/bukkit/src/main/resources/config.yml @@ -262,6 +262,7 @@ broadcast-received-log-entries: true redis: enabled: false address: localhost + username: '' password: '' # Settings for RabbitMQ. diff --git a/bungee/src/main/resources/config.yml b/bungee/src/main/resources/config.yml index 1b93a0d78..a3b5a19f7 100644 --- a/bungee/src/main/resources/config.yml +++ b/bungee/src/main/resources/config.yml @@ -260,6 +260,7 @@ broadcast-received-log-entries: false redis: enabled: false address: localhost + username: '' password: '' # Settings for RabbitMQ. diff --git a/common/src/main/java/me/lucko/luckperms/common/config/ConfigKeys.java b/common/src/main/java/me/lucko/luckperms/common/config/ConfigKeys.java index 1aa8d32e7..14c97cab3 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/ConfigKeys.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/ConfigKeys.java @@ -632,6 +632,11 @@ public final class ConfigKeys { */ public static final ConfigKey REDIS_ADDRESS = notReloadable(stringKey("redis.address", null)); + /** + * The username to connect with, or an empty string if it should use default + */ + public static final ConfigKey REDIS_USERNAME = notReloadable(stringKey("redis.username", "")); + /** * The password in use by the redis server, or an empty string if there is no password */ diff --git a/common/src/main/java/me/lucko/luckperms/common/messaging/MessagingFactory.java b/common/src/main/java/me/lucko/luckperms/common/messaging/MessagingFactory.java index db92439e9..4e369f23d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/messaging/MessagingFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/messaging/MessagingFactory.java @@ -140,13 +140,17 @@ public class MessagingFactory

{ LuckPermsConfiguration config = getPlugin().getConfiguration(); String address = config.get(ConfigKeys.REDIS_ADDRESS); + String username = config.get(ConfigKeys.REDIS_USERNAME); String password = config.get(ConfigKeys.REDIS_PASSWORD); if (password.isEmpty()) { password = null; } + if (username.isEmpty()) { + username = null; + } boolean ssl = config.get(ConfigKeys.REDIS_SSL); - redis.init(address, password, ssl); + redis.init(address, username, password, ssl); return redis; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/messaging/redis/RedisMessenger.java b/common/src/main/java/me/lucko/luckperms/common/messaging/redis/RedisMessenger.java index 859a93ed4..73cf911d9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/messaging/redis/RedisMessenger.java +++ b/common/src/main/java/me/lucko/luckperms/common/messaging/redis/RedisMessenger.java @@ -56,12 +56,16 @@ public class RedisMessenger implements Messenger { this.consumer = consumer; } - public void init(String address, String password, boolean ssl) { + public void init(String address, String username, String password, boolean ssl) { String[] addressSplit = address.split(":"); String host = addressSplit[0]; int port = addressSplit.length > 1 ? Integer.parseInt(addressSplit[1]) : Protocol.DEFAULT_PORT; - this.jedisPool = new JedisPool(new JedisPoolConfig(), host, port, Protocol.DEFAULT_TIMEOUT, password, ssl); + if (username == null) { + this.jedisPool = new JedisPool(new JedisPoolConfig(), host, port, Protocol.DEFAULT_TIMEOUT, password, ssl); + } else { + this.jedisPool = new JedisPool(new JedisPoolConfig(), host, port, Protocol.DEFAULT_TIMEOUT, username, password, ssl); + } this.sub = new Subscription(); this.plugin.getBootstrap().getScheduler().executeAsync(this.sub); diff --git a/fabric/src/main/resources/luckperms.conf b/fabric/src/main/resources/luckperms.conf index 2ffa927eb..8d3686dc8 100644 --- a/fabric/src/main/resources/luckperms.conf +++ b/fabric/src/main/resources/luckperms.conf @@ -265,6 +265,7 @@ broadcast-received-log-entries = true redis { enabled = false address = "localhost" + username = "" password = "" } diff --git a/nukkit/src/main/resources/config.yml b/nukkit/src/main/resources/config.yml index 8f6dfa7f0..e6cb4d832 100644 --- a/nukkit/src/main/resources/config.yml +++ b/nukkit/src/main/resources/config.yml @@ -257,6 +257,7 @@ broadcast-received-log-entries: true redis: enabled: false address: localhost + username: '' password: '' # Settings for RabbitMQ. diff --git a/sponge/src/main/resources/luckperms.conf b/sponge/src/main/resources/luckperms.conf index 764cac2f8..ae22acfd5 100644 --- a/sponge/src/main/resources/luckperms.conf +++ b/sponge/src/main/resources/luckperms.conf @@ -265,6 +265,7 @@ broadcast-received-log-entries = true redis { enabled = false address = "localhost" + username = "" password = "" } diff --git a/velocity/src/main/resources/config.yml b/velocity/src/main/resources/config.yml index 56f8799a3..7f82c0e09 100644 --- a/velocity/src/main/resources/config.yml +++ b/velocity/src/main/resources/config.yml @@ -251,6 +251,7 @@ broadcast-received-log-entries: false redis: enabled: false address: localhost + username: '' password: '' # Settings for RabbitMQ.