mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2025-04-20 17:47:06 +00:00
Assign and save random server id
This commit is contained in:
parent
4a4e6db36f
commit
2078287bec
@ -415,9 +415,6 @@ public final class RedisBungee extends Plugin {
|
|||||||
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 = configuration.getString("server-id");
|
String serverId = configuration.getString("server-id");
|
||||||
if (serverId == null || serverId.isEmpty()) {
|
|
||||||
serverId = UUID.randomUUID().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (redisPassword != null && (redisPassword.isEmpty() || redisPassword.equals("none"))) {
|
if (redisPassword != null && (redisPassword.isEmpty() || redisPassword.equals("none"))) {
|
||||||
redisPassword = null;
|
redisPassword = null;
|
||||||
@ -425,7 +422,8 @@ public final class RedisBungee extends Plugin {
|
|||||||
|
|
||||||
// Configuration sanity checks.
|
// Configuration sanity checks.
|
||||||
if (serverId == null || serverId.isEmpty()) {
|
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()) {
|
if (redisServer != null && !redisServer.isEmpty()) {
|
||||||
|
@ -22,11 +22,7 @@ public class RedisBungeeConfiguration {
|
|||||||
|
|
||||||
public RedisBungeeConfiguration(JedisPool pool, Configuration configuration) {
|
public RedisBungeeConfiguration(JedisPool pool, Configuration configuration) {
|
||||||
this.pool = pool;
|
this.pool = pool;
|
||||||
String serverId = configuration.getString("server-id");
|
this.serverId = configuration.getString("server-id");
|
||||||
if (serverId == null || serverId.isEmpty()) {
|
|
||||||
serverId = UUID.randomUUID().toString();
|
|
||||||
}
|
|
||||||
this.serverId = serverId;
|
|
||||||
|
|
||||||
this.registerBungeeCommands = configuration.getBoolean("register-bungee-commands", true);
|
this.registerBungeeCommands = configuration.getBoolean("register-bungee-commands", true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user