mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-05-03 11:40:29 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39b3c03604 | ||
|
|
373e1c16d4 | ||
|
|
56042af4eb | ||
|
|
8df8d96ced | ||
|
|
4c1ffa2b01 | ||
|
|
02caf2da5e | ||
|
|
a005b46467 | ||
|
|
65abb29558 | ||
|
|
5169d873a8 | ||
|
|
f0fbaab0b1 | ||
|
|
4091da2ed8 | ||
|
|
86bef752de | ||
|
|
17e203d7be | ||
|
|
ab8db5570c | ||
|
|
571a318969 | ||
|
|
f07eed220d |
2
.github/workflows/maven.yml
vendored
2
.github/workflows/maven.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
# This workflow will build a Java project with Maven
|
# 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
|
# 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:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|||||||
30
README.md
30
README.md
@@ -1,39 +1,47 @@
|
|||||||
# Limework fork of RedisBungee
|
# Limework fork of RedisBungee
|
||||||
|
|
||||||
|
[](https://github.com/Limework/RedisBungee/actions/workflows/maven.yml)
|
||||||
|
|
||||||
Spigot link: [click](https://www.spigotmc.org/resources/redisbungee.87700/)
|
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
|
## Compiling
|
||||||
|
|
||||||
Now you can use maven without installing it using Maven wrapper [github?](https://github.com/takari/maven-wrapper) :)
|
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
|
git clone https://github.com/Limework/RedisBungee.git
|
||||||
cd RedisBungee
|
cd RedisBungee
|
||||||
mvnw clean install
|
mvnw clean install
|
||||||
|
|
||||||
## Javadocs
|
And use it in your pom file.
|
||||||
The current version is 0.6-snapshot! will be updated every version number change!
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.imaginarycode.minecraft</groupId>
|
||||||
|
<artifactId>RedisBungee</artifactId>
|
||||||
|
<version>0.6.3</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
## Javadocs
|
||||||
|
Hosted on limework website. Version 0.6.0 (note: any version 0.6.* will not have API changes.)
|
||||||
https://limework.net/JavaDocs/RedisBungee/
|
https://limework.net/JavaDocs/RedisBungee/
|
||||||
|
|
||||||
## Configuration
|
## 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!
|
## License!
|
||||||
|
|
||||||
This project is distributed under Eclipse Public License 1.0
|
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/)
|
||||||
|
|||||||
9
pom.xml
9
pom.xml
@@ -6,14 +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.3</version>
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>Limework-Maven-Public</id>
|
|
||||||
<url>http://mc.limework.net:8081/repository/public-maven/</url>
|
|
||||||
</repository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|||||||
@@ -104,8 +104,8 @@ public final class RedisBungee extends Plugin {
|
|||||||
if (lagged ? time >= stamp + 30 : time <= stamp + 30)
|
if (lagged ? time >= stamp + 30 : time <= stamp + 30)
|
||||||
servers.add(entry.getKey());
|
servers.add(entry.getKey());
|
||||||
else if (nag && nagTime <= 0) {
|
else if (nag && nagTime <= 0) {
|
||||||
getLogger().severe(entry.getKey() + " is " + (time - stamp) + " seconds behind! (Time not synchronized or server down?) and was removed from heartbeat.");
|
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());
|
jedis.hdel("heartbeats", entry.getKey());
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
}
|
}
|
||||||
@@ -416,6 +416,7 @@ 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");
|
||||||
|
final String randomUUID = UUID.randomUUID().toString();
|
||||||
|
|
||||||
if (redisPassword != null && (redisPassword.isEmpty() || redisPassword.equals("none"))) {
|
if (redisPassword != null && (redisPassword.isEmpty() || redisPassword.equals("none"))) {
|
||||||
redisPassword = null;
|
redisPassword = null;
|
||||||
@@ -423,7 +424,20 @@ 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");
|
/*
|
||||||
|
* this check causes the config comments to disappear somehow
|
||||||
|
* I think due snake yaml limitations so as todo: write our own yaml parser?
|
||||||
|
*/
|
||||||
|
String genId = UUID.randomUUID().toString();
|
||||||
|
getLogger().info("Generated server id " + genId + " and saving it to config.");
|
||||||
|
configuration.set("server-id", genId);
|
||||||
|
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, new File(getDataFolder(), "config.yml"));
|
||||||
|
} else {
|
||||||
|
getLogger().info("Loaded server id " + serverId + '.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configuration.getBoolean("use-random-id-string", false)) {
|
||||||
|
serverId = configuration.getString("server-id") + "-" + randomUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redisServer != null && !redisServer.isEmpty()) {
|
if (redisServer != null && !redisServer.isEmpty()) {
|
||||||
@@ -475,7 +489,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public class RedisBungeeListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPluginMessage(final PluginMessageEvent event) {
|
public void onPluginMessage(final PluginMessageEvent event) {
|
||||||
if ((event.getTag().equals("legacy:RedisBungee") || event.getTag().equals("RedisBungee")) && event.getSender() instanceof Server) {
|
if ((event.getTag().equals("legacy:redisbungee") || event.getTag().equals("RedisBungee")) && event.getSender() instanceof Server) {
|
||||||
final String currentChannel = event.getTag();
|
final String currentChannel = event.getTag();
|
||||||
final byte[] data = Arrays.copyOf(event.getData(), event.getData().length);
|
final byte[] data = Arrays.copyOf(event.getData(), event.getData().length);
|
||||||
plugin.getProxy().getScheduler().runAsync(plugin, new Runnable() {
|
plugin.getProxy().getScheduler().runAsync(plugin, new Runnable() {
|
||||||
|
|||||||
@@ -16,8 +16,13 @@ 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. Will randomly generate 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"
|
||||||
|
# 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
|
||||||
|
# and used for if proxy died in a kubernetes network and deleted then new proxy setup itself.
|
||||||
|
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
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
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: Chunker and Govindas limework
|
author: Chunkr and Govindas limework
|
||||||
authors:
|
authors:
|
||||||
- chunkr
|
- chunkr
|
||||||
- Govindas Limework
|
- Govindas Limework
|
||||||
|
|||||||
Reference in New Issue
Block a user