mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-05-03 03:30:26 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39b3c03604 | ||
|
|
373e1c16d4 | ||
|
|
56042af4eb |
@@ -21,7 +21,14 @@ RedisBungee is distributed as a [maven](https://maven.apache.org) project. To co
|
|||||||
cd RedisBungee
|
cd RedisBungee
|
||||||
mvnw clean install
|
mvnw clean install
|
||||||
|
|
||||||
|
And use it in your pom file.
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.imaginarycode.minecraft</groupId>
|
||||||
|
<artifactId>RedisBungee</artifactId>
|
||||||
|
<version>0.6.3</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
## Javadocs
|
## Javadocs
|
||||||
Hosted on limework website. Version 0.6.0 (note: any version 0.6.* will not have API changes.)
|
Hosted on limework website. Version 0.6.0 (note: any version 0.6.* will not have API changes.)
|
||||||
|
|||||||
3
pom.xml
3
pom.xml
@@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
<groupId>com.imaginarycode.minecraft</groupId>
|
<groupId>com.imaginarycode.minecraft</groupId>
|
||||||
<artifactId>RedisBungee</artifactId>
|
<artifactId>RedisBungee</artifactId>
|
||||||
<version>0.6.2</version>
|
<version>0.6.3</version>
|
||||||
|
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public final class RedisBungee extends Plugin {
|
|||||||
servers.add(entry.getKey());
|
servers.add(entry.getKey());
|
||||||
else if (nag && nagTime <= 0) {
|
else if (nag && nagTime <= 0) {
|
||||||
getLogger().warning(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) {
|
||||||
}
|
}
|
||||||
@@ -415,13 +415,8 @@ 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;
|
String serverId = configuration.getString("server-id");
|
||||||
final String randomUUID = UUID.randomUUID().toString();
|
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;
|
||||||
@@ -429,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()) {
|
||||||
|
|||||||
@@ -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,11 +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. Will randomly generate if leaving it blank.
|
||||||
# An identifier for this BungeeCord instance.
|
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 enabled proxy id will be like this "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
|
# 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
|
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.
|
||||||
|
|||||||
@@ -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