diff --git a/README.md b/README.md index 4a349cf..3920b86 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,9 @@ This is currently deployed on [Govindas Limework!](https://Limework.net) ![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 diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/DataManager.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/DataManager.java index cf6a2cb..e7f9662 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/DataManager.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/DataManager.java @@ -188,7 +188,7 @@ public class DataManager implements Listener { plugin.getProxy().getScheduler().runAsync(plugin, () -> plugin.getProxy().getPluginManager().callEvent(new PlayerLeftNetworkEvent(message2.getTarget()))); break; case SERVER_CHANGE: - final DataManagerMessage message3 = plugin.getGson().fromJson(jsonObject, new TypeToken>() { + final DataManagerMessage message3 = RedisBungee.getGson().fromJson(jsonObject, new TypeToken>() { }.getType()); 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()))); diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java index 0593e43..d24f023 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java @@ -263,7 +263,7 @@ public final class RedisBungee extends Plugin { if (s.startsWith("redis_version:")) { String version = s.split(":")[1]; 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"); } getLogger().info("found a supported redis version: " + version); diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisUtil.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisUtil.java index d76c7ac..914665b 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisUtil.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisUtil.java @@ -63,13 +63,13 @@ public class RedisUtil { } 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("\\."); if (args.length < 2) { - return false; + return Integer.parseInt(args[0]) == 6; } int major = Integer.parseInt(args[0]); int minor = Integer.parseInt(args[1]); - return major >= 6 && minor >= 2; + return major >= 6 && minor >= 0; } } diff --git a/src/main/resources/example_config.yml b/src/main/resources/example_config.yml index be0c1cd..2186dbf 100644 --- a/src/main/resources/example_config.yml +++ b/src/main/resources/example_config.yml @@ -5,19 +5,38 @@ # Get Redis from http://redis.io/ redis-server: 127.0.0.1 redis-port: 6379 -# OPTIONAL: If your Redis server uses AUTH, set the password required. -redis-password: "" -# 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 -# inefficient plugins or a lot of players. -max-redis-connections: 8 -# 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!!! +################################################################# +# 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: "" + +# Maximum connections that will be maintained to the Redis server. +# The default is 10. This setting should be left as-is unless you have some wildly +# inefficient plugins or a lot of players. +max-redis-connections: 10 + +# since redis can support ssl by version 6 you can use ssl in redis bungee too! +# its' recommended to use redis with ssl to encrypt the traffic. 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" + # 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" # this great for servers who run replicas in Kubernetes or any auto deploying replica service diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 27b3ff5..85ac8ed 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,9 +1,10 @@ name: ${project.name} main: com.imaginarycode.minecraft.redisbungee.RedisBungee version: ${project.version} -author: Chunkr and Govindas limework +author: Chunker and Govindas limework authors: - - chunkr + - chunker - Govindas Limework + # This is used so that we can automatically override default BungeeCord behavior. softDepends: ["cmd_find", "cmd_list"] \ No newline at end of file diff --git a/src/test/java/com/imaginarycode/minecraft/redisbungee/test/RedisUtilTest.java b/src/test/java/com/imaginarycode/minecraft/redisbungee/test/RedisUtilTest.java index e00cbfc..654032a 100644 --- a/src/test/java/com/imaginarycode/minecraft/redisbungee/test/RedisUtilTest.java +++ b/src/test/java/com/imaginarycode/minecraft/redisbungee/test/RedisUtilTest.java @@ -8,8 +8,8 @@ public class RedisUtilTest { @Test public void testRedisVersion() { Assert.assertTrue(RedisUtil.isRedisVersionSupported("6.2.0")); - Assert.assertFalse(RedisUtil.isRedisVersionSupported(("6.1.0"))); - Assert.assertFalse(RedisUtil.isRedisVersionSupported(("6.0.0"))); + Assert.assertTrue(RedisUtil.isRedisVersionSupported(("6.1.0"))); + Assert.assertTrue(RedisUtil.isRedisVersionSupported(("6.0.0"))); Assert.assertFalse(RedisUtil.isRedisVersionSupported(("2.6.0"))); Assert.assertFalse(RedisUtil.isRedisVersionSupported(("2.2.12"))); Assert.assertFalse(RedisUtil.isRedisVersionSupported(("1.2.4")));