diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java index 0d9485e..a4cb965 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java @@ -415,9 +415,6 @@ public final class RedisBungee extends Plugin { final boolean useSSL = configuration.getBoolean("useSSL"); String redisPassword = configuration.getString("redis-password"); String serverId = configuration.getString("server-id"); - if (serverId == null || serverId.isEmpty()) { - serverId = UUID.randomUUID().toString(); - } if (redisPassword != null && (redisPassword.isEmpty() || redisPassword.equals("none"))) { redisPassword = null; @@ -425,7 +422,8 @@ public final class RedisBungee extends Plugin { // Configuration sanity checks. if (serverId == null || serverId.isEmpty()) { - throw new RuntimeException("server-id is not specified in the configuration or is empty"); + configuration.set("server-id", UUID.randomUUID().toString()); + ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, new File(getDataFolder(), "config.yml")); } if (redisServer != null && !redisServer.isEmpty()) { diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeConfiguration.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeConfiguration.java index 474e4ab..09ac800 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeConfiguration.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeConfiguration.java @@ -22,11 +22,7 @@ public class RedisBungeeConfiguration { public RedisBungeeConfiguration(JedisPool pool, Configuration configuration) { this.pool = pool; - String serverId = configuration.getString("server-id"); - if (serverId == null || serverId.isEmpty()) { - serverId = UUID.randomUUID().toString(); - } - this.serverId = serverId; + this.serverId = configuration.getString("server-id"); this.registerBungeeCommands = configuration.getBoolean("register-bungee-commands", true);