diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 1531e21..80835f3 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,7 +1,7 @@ # This workflow will build a Java project with Maven # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven -name: Java CI with Maven +name: RedisBungee Build on: push: @@ -19,7 +19,14 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v2 with: - java-version: '11' + java-version: '8' distribution: 'adopt' - name: Build with Maven run: mvn -B package --file pom.xml + - name: Download a Build Artifact + uses: actions/upload-artifact@v2.2.3 + with: + # Artifact name + name: Redis_JAR + # Destination path + path: target/RedisBungee* diff --git a/README.md b/README.md index df61b0e..2bc12e1 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,47 @@ # Limework fork of RedisBungee +[![RedisBungee Build](https://github.com/Limework/RedisBungee/actions/workflows/maven.yml/badge.svg)](https://github.com/Limework/RedisBungee/actions/workflows/maven.yml) + Spigot link: [click](https://www.spigotmc.org/resources/redisbungee.87700/) -this fork was made due the maintainer of redisBungee became inactive, so we took the place to develop it! +The maintainer of RedisBungee has became inactive, so we have taken the development of the plugin. -RedisBungee bridges [Redis](http://redis.io) and BungeeCord together. +RedisBungee bridges [Redis](https://redis.io) and [BungeeCord](https://github.com/SpigotMC/BungeeCord) together. -RedisBungee was used on thechunk server which we think was shutdown due website not loading... -~~This is the solution deployed on [The Chunk](http://thechunk.net) to make sure our multi-Bungee setup flows smoothly together.~~ -this will be deployed soon on [Govindas limework!](https://Limework.net) +This is currently deployed on [Govindas Limework!](https://Limework.net) ## Compiling Now you can use maven without installing it using Maven wrapper [github?](https://github.com/takari/maven-wrapper) :) -RedisBungee is distributed as a [maven](http://maven.apache.org) project. To compile it and install it in your local Maven repository: +RedisBungee is distributed as a [maven](https://maven.apache.org) project. To compile it and install it in your local Maven repository: git clone https://github.com/Limework/RedisBungee.git cd RedisBungee mvnw clean install -## Javadocs -The current version is 0.6-snapshot! will be updated every version number change! +And use it in your pom file. + + com.imaginarycode.minecraft + RedisBungee + 0.6.2 + provided + + +## Javadocs +Hosted on limework website. Version 0.6.0 (note: any version 0.6.* will not have API changes.) https://limework.net/JavaDocs/RedisBungee/ ## Configuration -**REDISBUNGEE REQUIRES A REDIS SERVER**, preferably with reasonably low latency. The default [config](https://github.com/minecrafter/RedisBungee/blob/master/src/main/resources/example_config.yml) is saved when the plugin first starts. +**REDISBUNGEE REQUIRES A REDIS SERVER**, preferably with reasonably low latency. The default [config](https://github.com/limework/RedisBungee/blob/master/src/main/resources/example_config.yml) is saved when the plugin first starts. ## License! This project is distributed under Eclipse Public License 1.0 -which you can find it [here](https://github.com/Limework/RedisBungee/blob/master/LICENSE) +You can find it [here](https://github.com/Limework/RedisBungee/blob/master/LICENSE) -you can find the original redisBungee by minecrafter [here](https://github.com/minecrafter/RedisBungee) or spigot page [here](https://www.spigotmc.org/resources/redisbungee.13494/) +You can find the original RedisBungee by minecrafter [here](https://github.com/minecrafter/RedisBungee) or spigot page [here](https://www.spigotmc.org/resources/redisbungee.13494/) diff --git a/pom.xml b/pom.xml index 192a783..6026e26 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.imaginarycode.minecraft RedisBungee - 0.6.1 + 0.6.3 diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java index 66db192..72fd268 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java @@ -104,7 +104,8 @@ public final class RedisBungee extends Plugin { if (lagged ? time >= stamp + 30 : time <= stamp + 30) servers.add(entry.getKey()); else if (nag && nagTime <= 0) { - getLogger().severe(entry.getKey() + " is " + (time - stamp) + " seconds behind! (Time not synchronized or server down?)"); + getLogger().warning(entry.getKey() + " is " + (time - stamp) + " seconds behind! (Time not synchronized or server down?) and was removed from heartbeat."); + jedis.hdel("heartbeats", entry.getKey()); } } catch (NumberFormatException ignored) { } @@ -414,7 +415,13 @@ public final class RedisBungee extends Plugin { final int redisPort = configuration.getInt("redis-port", 6379); final boolean useSSL = configuration.getBoolean("useSSL"); 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"))) { redisPassword = null; @@ -479,7 +486,7 @@ public final class RedisBungee extends Plugin { httpClient.setDispatcher(dispatcher); NameFetcher.setHttpClient(httpClient); UUIDFetcher.setHttpClient(httpClient); - RedisBungee.configuration = new RedisBungeeConfiguration(RedisBungee.this.getPool(), configuration); + RedisBungee.configuration = new RedisBungeeConfiguration(RedisBungee.this.getPool(), configuration, randomUUID); return null; } }); diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeConfiguration.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeConfiguration.java index 09ac800..d5b68b1 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeConfiguration.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeConfiguration.java @@ -20,9 +20,14 @@ public class RedisBungeeConfiguration { @Getter private final List exemptAddresses; - public RedisBungeeConfiguration(JedisPool pool, Configuration configuration) { + + public RedisBungeeConfiguration(JedisPool pool, Configuration configuration, String randomUUID) { 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); @@ -35,4 +40,5 @@ public class RedisBungeeConfiguration { this.exemptAddresses = addressBuilder.build(); } + } diff --git a/src/main/resources/example_config.yml b/src/main/resources/example_config.yml index cd1649e..0bc5c94 100644 --- a/src/main/resources/example_config.yml +++ b/src/main/resources/example_config.yml @@ -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!!! useSSL: false + # An identifier for this BungeeCord instance. -server-id: "" +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. # Often, the RedisBungee commands are desired, but in some cases someone may wish to