2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-05 04:48:02 +00:00

Assign and save random server id

This commit is contained in:
Weihao 2021-05-08 02:36:40 -04:00
parent 4a4e6db36f
commit 2078287bec
2 changed files with 3 additions and 9 deletions

View File

@ -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()) {

View File

@ -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);