mirror of
				https://github.com/proxiodev/RedisBungee.git
				synced 2025-11-04 01:28:02 +00:00 
			
		
		
		
	add random ids!
This commit is contained in:
		
							parent
							
								
									4c1ffa2b01
								
							
						
					
					
						commit
						8df8d96ced
					
				
							
								
								
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							@ -6,7 +6,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <groupId>com.imaginarycode.minecraft</groupId>
 | 
					    <groupId>com.imaginarycode.minecraft</groupId>
 | 
				
			||||||
    <artifactId>RedisBungee</artifactId>
 | 
					    <artifactId>RedisBungee</artifactId>
 | 
				
			||||||
    <version>0.6.1</version>
 | 
					    <version>0.6.2</version>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <repositories>
 | 
					    <repositories>
 | 
				
			||||||
        <repository>
 | 
					        <repository>
 | 
				
			||||||
 | 
				
			|||||||
@ -415,7 +415,13 @@ 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 = configuration.getString("server-id");
 | 
					        String serverId;
 | 
				
			||||||
 | 
					        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;
 | 
				
			||||||
@ -475,7 +481,7 @@ public final class RedisBungee extends Plugin {
 | 
				
			|||||||
                        httpClient.setDispatcher(dispatcher);
 | 
					                        httpClient.setDispatcher(dispatcher);
 | 
				
			||||||
                        NameFetcher.setHttpClient(httpClient);
 | 
					                        NameFetcher.setHttpClient(httpClient);
 | 
				
			||||||
                        UUIDFetcher.setHttpClient(httpClient);
 | 
					                        UUIDFetcher.setHttpClient(httpClient);
 | 
				
			||||||
                        RedisBungee.configuration = new RedisBungeeConfiguration(RedisBungee.this.getPool(), configuration);
 | 
					                        RedisBungee.configuration = new RedisBungeeConfiguration(RedisBungee.this.getPool(), configuration, randomUUID);
 | 
				
			||||||
                        return null;
 | 
					                        return null;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@ import redis.clients.jedis.JedisPool;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.net.InetAddress;
 | 
					import java.net.InetAddress;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.UUID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class RedisBungeeConfiguration {
 | 
					public class RedisBungeeConfiguration {
 | 
				
			||||||
    @Getter
 | 
					    @Getter
 | 
				
			||||||
@ -19,9 +20,15 @@ public class RedisBungeeConfiguration {
 | 
				
			|||||||
    @Getter
 | 
					    @Getter
 | 
				
			||||||
    private final List<InetAddress> exemptAddresses;
 | 
					    private final List<InetAddress> exemptAddresses;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public RedisBungeeConfiguration(JedisPool pool, Configuration configuration) {
 | 
					
 | 
				
			||||||
 | 
					    public RedisBungeeConfiguration(JedisPool pool, Configuration configuration, String randomUUID) {
 | 
				
			||||||
        this.pool = pool;
 | 
					        this.pool = pool;
 | 
				
			||||||
        this.serverId = configuration.getString("server-id");
 | 
					        if (configuration.getBoolean("use-random-id-string", false)) {
 | 
				
			||||||
 | 
					            this.serverId = configuration.getString("server-id") + "-" + randomUUID;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            this.serverId = configuration.getString("server-id");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.registerBungeeCommands = configuration.getBoolean("register-bungee-commands", true);
 | 
					        this.registerBungeeCommands = configuration.getBoolean("register-bungee-commands", true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        List<String> stringified = configuration.getStringList("exempt-ip-addresses");
 | 
					        List<String> stringified = configuration.getStringList("exempt-ip-addresses");
 | 
				
			||||||
@ -33,4 +40,5 @@ public class RedisBungeeConfiguration {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        this.exemptAddresses = addressBuilder.build();
 | 
					        this.exemptAddresses = addressBuilder.build();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -16,8 +16,12 @@ max-redis-connections: 8
 | 
				
			|||||||
# you must disable this if redis version is under 6 you must disable this or connection wont work!!!
 | 
					# you must disable this if redis version is under 6 you must disable this or connection wont work!!!
 | 
				
			||||||
useSSL: false
 | 
					useSSL: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# An identifier for this BungeeCord instance.
 | 
					# An identifier for this BungeeCord instance.
 | 
				
			||||||
server-id: test1
 | 
					server-id: test1
 | 
				
			||||||
 | 
					# Should use random string? if enabled proxy id will be like this "test1-66cd2aeb-91f3-43a7-a106-e0307b098652"
 | 
				
			||||||
 | 
					# this great for servers who run replicas in Kubernetes or any auto deploying replica service
 | 
				
			||||||
 | 
					use-random-id-string: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Whether or not RedisBungee should install its version of regular BungeeCord commands.
 | 
					# Whether or not RedisBungee should install its version of regular BungeeCord commands.
 | 
				
			||||||
# Often, the RedisBungee commands are desired, but in some cases someone may wish to
 | 
					# Often, the RedisBungee commands are desired, but in some cases someone may wish to
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user