2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2025-03-09 22:25:31 +00:00

make platforms can't see each other when using same redis server and network id

This commit is contained in:
Mohammed Alteneiji 2025-02-21 19:44:52 +04:00
parent 287f037774
commit 8177260991
Signed by: ham1255
GPG Key ID: EF343502046229F4
5 changed files with 16 additions and 4 deletions

View File

@ -92,5 +92,5 @@ public interface RedisBungeePlugin<P> extends EventsPlatform {
void executeAsyncAfter(Runnable runnable, TimeUnit timeUnit, int time);
String platformId();
}

View File

@ -97,8 +97,9 @@ public interface ConfigLoader extends GenericConfigLoader {
}
plugin.logInfo("Loaded network id " + networkId);
// TO avoid proxies from different platforms from seeing each other.
networkId = plugin.platformId() + "-" + networkId;
plugin.logInfo("Platform is {} so network id is now is {}", plugin.platformId(), networkId);
boolean reconnectToLastServer = node.getNode("reconnect-to-last-server").getBoolean();
boolean handleMotd = node.getNode("handle-motd").getBoolean(true);

View File

@ -50,6 +50,8 @@ useSSL: false
# An identifier for this network, which helps to separate redisbungee instances on same redis instance.
# You can use environment variable 'REDISBUNGEE_NETWORK_ID' to override
# Depending on the platform bungeecord or velocity system will append platform id to the network id
# to prevent proxies from different platforms from seeing each other. since 0.13.0
network-id: "main"
# An identifier for this BungeeCord / Velocity instance. Will randomly generate if leaving it blank.

View File

@ -355,9 +355,13 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
return api.getJedisPool();
}
@Override
public void onLangConfigLoad(LangConfiguration langConfiguration) {
this.langConfiguration = langConfiguration;
}
@Override
public String platformId() {
return "bungeecord";
}
}

View File

@ -367,4 +367,9 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
public InputStream getResourceAsStream(String name) {
return this.getClass().getClassLoader().getResourceAsStream(name);
}
@Override
public String platformId() {
return "velocity";
}
}