2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-09-28 19:28:01 +00:00

fixed bug from last update

This commit is contained in:
mohammed jasem alaajel 2021-05-21 01:00:47 +04:00
parent f1d26c8d5e
commit 8b22747b09

View File

@ -415,13 +415,8 @@ public final class RedisBungee extends Plugin {
final int redisPort = configuration.getInt("redis-port", 6379); final int redisPort = configuration.getInt("redis-port", 6379);
final boolean useSSL = configuration.getBoolean("useSSL"); final boolean useSSL = configuration.getBoolean("useSSL");
String redisPassword = configuration.getString("redis-password"); String redisPassword = configuration.getString("redis-password");
String serverId; String serverId = configuration.getString("server-id");
final String randomUUID = UUID.randomUUID().toString(); final String randomUUID = UUID.randomUUID().toString();
if (configuration.getBoolean("use-random-id-string", false)) {
serverId = configuration.getString("server-id") + "-" + randomUUID;
} else {
serverId = configuration.getString("server-id");
}
if (redisPassword != null && (redisPassword.isEmpty() || redisPassword.equals("none"))) { if (redisPassword != null && (redisPassword.isEmpty() || redisPassword.equals("none"))) {
redisPassword = null; redisPassword = null;
@ -429,6 +424,10 @@ public final class RedisBungee extends Plugin {
// Configuration sanity checks. // Configuration sanity checks.
if (serverId == null || serverId.isEmpty()) { if (serverId == null || serverId.isEmpty()) {
/*
* this check causes the config comments to disappear somehow
* I think due snake yaml limitations so as todo: write our own yaml parser?
*/
String genId = UUID.randomUUID().toString(); String genId = UUID.randomUUID().toString();
getLogger().info("Generated server id " + genId + " and saving it to config."); getLogger().info("Generated server id " + genId + " and saving it to config.");
configuration.set("server-id", genId); configuration.set("server-id", genId);
@ -437,6 +436,10 @@ public final class RedisBungee extends Plugin {
getLogger().info("Loaded server id " + serverId + '.'); getLogger().info("Loaded server id " + serverId + '.');
} }
if (configuration.getBoolean("use-random-id-string", false)) {
serverId = configuration.getString("server-id") + "-" + randomUUID;
}
if (redisServer != null && !redisServer.isEmpty()) { if (redisServer != null && !redisServer.isEmpty()) {
final String finalRedisPassword = redisPassword; final String finalRedisPassword = redisPassword;
FutureTask<JedisPool> task = new FutureTask<>(new Callable<JedisPool>() { FutureTask<JedisPool> task = new FutureTask<>(new Callable<JedisPool>() {