2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2025-04-20 01:27:07 +00:00

redis senitel and version to 6 rather than 6.2

This commit is contained in:
mohammed jasem alaajel 2021-06-25 10:20:38 +04:00
parent 8a64ef59f0
commit b9d3defe8c
7 changed files with 40 additions and 20 deletions

View File

@ -13,9 +13,9 @@ This is currently deployed on [Govindas Limework!](https://Limework.net)
![image](https://limework.net/logo.png) ![image](https://limework.net/logo.png)
## Notice: about older versions of redis than redis 6.2 ## Notice: about older versions of redis than redis 6.0
As of now Version 0.7.0-SNAPSHOT is only supporting redis 6.2 and above! As of now Version 0.7.0-SNAPSHOT is only supporting redis 6.0 and above!
## Compiling ## Compiling

View File

@ -188,7 +188,7 @@ public class DataManager implements Listener {
plugin.getProxy().getScheduler().runAsync(plugin, () -> plugin.getProxy().getPluginManager().callEvent(new PlayerLeftNetworkEvent(message2.getTarget()))); plugin.getProxy().getScheduler().runAsync(plugin, () -> plugin.getProxy().getPluginManager().callEvent(new PlayerLeftNetworkEvent(message2.getTarget())));
break; break;
case SERVER_CHANGE: case SERVER_CHANGE:
final DataManagerMessage<ServerChangePayload> message3 = plugin.getGson().fromJson(jsonObject, new TypeToken<DataManagerMessage<ServerChangePayload>>() { final DataManagerMessage<ServerChangePayload> message3 = RedisBungee.getGson().fromJson(jsonObject, new TypeToken<DataManagerMessage<ServerChangePayload>>() {
}.getType()); }.getType());
serverCache.put(message3.getTarget(), message3.getPayload().getServer()); serverCache.put(message3.getTarget(), message3.getPayload().getServer());
plugin.getProxy().getScheduler().runAsync(plugin, () -> plugin.getProxy().getPluginManager().callEvent(new PlayerChangedServerNetworkEvent(message3.getTarget(), message3.getPayload().getOldServer(), message3.getPayload().getServer()))); plugin.getProxy().getScheduler().runAsync(plugin, () -> plugin.getProxy().getPluginManager().callEvent(new PlayerChangedServerNetworkEvent(message3.getTarget(), message3.getPayload().getOldServer(), message3.getPayload().getServer())));

View File

@ -263,7 +263,7 @@ public final class RedisBungee extends Plugin {
if (s.startsWith("redis_version:")) { if (s.startsWith("redis_version:")) {
String version = s.split(":")[1]; String version = s.split(":")[1];
if (!RedisUtil.isRedisVersionSupported((version))) { if (!RedisUtil.isRedisVersionSupported((version))) {
getLogger().warning("Your version of Redis (" + version + ") is not at least version 6.2 RedisBungee requires a newer version of Redis."); getLogger().warning("Your version of Redis (" + version + ") is not at least version 6.0 RedisBungee requires a newer version of Redis.");
throw new RuntimeException("Unsupported Redis version detected"); throw new RuntimeException("Unsupported Redis version detected");
} }
getLogger().info("found a supported redis version: " + version); getLogger().info("found a supported redis version: " + version);

View File

@ -63,13 +63,13 @@ public class RedisUtil {
} }
public static boolean isRedisVersionSupported(String redisVersion) { public static boolean isRedisVersionSupported(String redisVersion) {
// Need to use >=6.2 to use Lua optimizations. // Need to use >=6.0 to use Lua optimizations.
String[] args = redisVersion.split("\\."); String[] args = redisVersion.split("\\.");
if (args.length < 2) { if (args.length < 2) {
return false; return Integer.parseInt(args[0]) == 6;
} }
int major = Integer.parseInt(args[0]); int major = Integer.parseInt(args[0]);
int minor = Integer.parseInt(args[1]); int minor = Integer.parseInt(args[1]);
return major >= 6 && minor >= 2; return major >= 6 && minor >= 0;
} }
} }

View File

@ -5,19 +5,38 @@
# Get Redis from http://redis.io/ # Get Redis from http://redis.io/
redis-server: 127.0.0.1 redis-server: 127.0.0.1
redis-port: 6379 redis-port: 6379
# OPTIONAL: If your Redis server uses AUTH, set the password required.
#################################################################
# If enabled redis-server and redis-port will be ignored.
use-sentinel: false
sentinels:
- "127.0.0.1:6379"
- "127.0.0.1:6378"
- "127.0.0.1:6377"
# Your master name
master-name: mymaster
##################################################################
# OPTIONAL: If your Redis server or sentinel uses AUTH, set the password required.
# WARNING: Leaving your Redis server or sentinel exposed without a password is extremely unsafe
# and could cause issues like data not being sync and etc.
redis-password: "" redis-password: ""
# Maximum connections that will be maintained to the Redis server. # Maximum connections that will be maintained to the Redis server.
# The default is 8. This setting should be left as-is unless you have some wildly # The default is 10. This setting should be left as-is unless you have some wildly
# inefficient plugins or a lot of players. # inefficient plugins or a lot of players.
max-redis-connections: 8 max-redis-connections: 10
# since redis can support ssl by version 6 you can use ssl in redis bungee too! # since redis can support ssl by version 6 you can use ssl in redis bungee too!
# you must disable this if redis version is under 6 you must disable this or connection wont work!!! # its' recommended to use redis with ssl to encrypt the traffic.
useSSL: false useSSL: false
# An identifier for this BungeeCord instance. Will randomly generate if leaving it blank. # An identifier for this BungeeCord instance. Will randomly generate a UUID String if leaving it blank.
server-id: "test1" server-id: "test1"
# Should use random string? if this is enabled the proxy id will be like this if server-id is test1: "test1-66cd2aeb-91f3-43a7-a106-e0307b098652" # Should use random string? if this is enabled the proxy id will be like this if server-id is test1: "test1-66cd2aeb-91f3-43a7-a106-e0307b098652"
# or if id is limework-bungee it will be "limework-bungee-66cd2aeb-91f3-43a7-a106-e0307b098652" # or if id is limework-bungee it will be "limework-bungee-66cd2aeb-91f3-43a7-a106-e0307b098652"
# this great for servers who run replicas in Kubernetes or any auto deploying replica service # this great for servers who run replicas in Kubernetes or any auto deploying replica service

View File

@ -1,9 +1,10 @@
name: ${project.name} name: ${project.name}
main: com.imaginarycode.minecraft.redisbungee.RedisBungee main: com.imaginarycode.minecraft.redisbungee.RedisBungee
version: ${project.version} version: ${project.version}
author: Chunkr and Govindas limework author: Chunker and Govindas limework
authors: authors:
- chunkr - chunker
- Govindas Limework - Govindas Limework
# This is used so that we can automatically override default BungeeCord behavior. # This is used so that we can automatically override default BungeeCord behavior.
softDepends: ["cmd_find", "cmd_list"] softDepends: ["cmd_find", "cmd_list"]

View File

@ -8,8 +8,8 @@ public class RedisUtilTest {
@Test @Test
public void testRedisVersion() { public void testRedisVersion() {
Assert.assertTrue(RedisUtil.isRedisVersionSupported("6.2.0")); Assert.assertTrue(RedisUtil.isRedisVersionSupported("6.2.0"));
Assert.assertFalse(RedisUtil.isRedisVersionSupported(("6.1.0"))); Assert.assertTrue(RedisUtil.isRedisVersionSupported(("6.1.0")));
Assert.assertFalse(RedisUtil.isRedisVersionSupported(("6.0.0"))); Assert.assertTrue(RedisUtil.isRedisVersionSupported(("6.0.0")));
Assert.assertFalse(RedisUtil.isRedisVersionSupported(("2.6.0"))); Assert.assertFalse(RedisUtil.isRedisVersionSupported(("2.6.0")));
Assert.assertFalse(RedisUtil.isRedisVersionSupported(("2.2.12"))); Assert.assertFalse(RedisUtil.isRedisVersionSupported(("2.2.12")));
Assert.assertFalse(RedisUtil.isRedisVersionSupported(("1.2.4"))); Assert.assertFalse(RedisUtil.isRedisVersionSupported(("1.2.4")));