mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-05-03 11:40:29 +00:00
Compare commits
75 Commits
0.12.2
...
1decbd6c7b
| Author | SHA1 | Date | |
|---|---|---|---|
|
1decbd6c7b
|
|||
|
de3ce79a0e
|
|||
|
089c5d8e5f
|
|||
|
294a8a5031
|
|||
|
e8bacfe0f5
|
|||
|
dc56a419e7
|
|||
| d0ae5d5342 | |||
| b88202ae38 | |||
| 3c4e45dfe2 | |||
| abd19c1c3a | |||
| b406c89406 | |||
| 91c3845b2e | |||
| 97e6b5c944 | |||
| 65ac465915 | |||
| 32826d843c | |||
| 78561fa467 | |||
| ab441503c7 | |||
| 51719f13e2 | |||
| 2015d1d0fd | |||
| 70aacc99c0 | |||
| 72025bc22c | |||
| de65b163e2 | |||
| 1e7f474a09 | |||
| 19064e0a60 | |||
| e76f0d0a00 | |||
| 40c542a50a | |||
| 86f64ab019 | |||
| 41b5bde55c | |||
| e5b1f9d76e | |||
|
|
0b8dc4bde6 | ||
| 782f0994c2 | |||
| ca8377ad4c | |||
| 69c3e30344 | |||
| b3eacbd1c4 | |||
| 72b2d46dcd | |||
| 44175e8a68 | |||
| 6c27228920 | |||
| 2eb7f3cf9d | |||
| 1c36aa5418 | |||
| c56a64bbc2 | |||
| 2429cc63d5 | |||
| 46d53fc018 | |||
| d70a5de829 | |||
| a6c6916103 | |||
| fa7ca2dacb | |||
| da255860bd | |||
| 983693b929 | |||
| 32b5e829ba | |||
| 383e647c87 | |||
| 9b54ca93db | |||
| eed91dd73d | |||
| b76709c291 | |||
| 4f6529b295 | |||
| 97cdf31cfc | |||
| 5ea8932ac4 | |||
| 20932d894b | |||
| 6bcba06f7a | |||
| 76c362cf66 | |||
| b7433bc9a3 | |||
| 7ba54ebfe2 | |||
| dd38532501 | |||
| 7183e809d0 | |||
| d1d848fa8c | |||
| e70a6e305c | |||
| e897a60976 | |||
| f6e1ca65bf | |||
| 11a0d84368 | |||
| a0fdd6d997 | |||
| 3c4f0d8c93 | |||
| 6d40c1902a | |||
| a2f1ec22c6 | |||
| 16576ab4c2 | |||
| f96c5759a2 | |||
| 8aaae6702e | |||
| 006066f66c |
4
.github/workflows/gradle.yml
vendored
4
.github/workflows/gradle.yml
vendored
@@ -5,9 +5,9 @@ name: RedisBungee Build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ develop ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [ develop ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ or [Velocity*](https://github.com/PaperMC/Velocity) proxies
|
|||||||
|
|
||||||
[](https://modrinth.com/plugin/redisbungee)
|
[](https://modrinth.com/plugin/redisbungee)
|
||||||
|
|
||||||
## Wiki
|
|
||||||
|
|
||||||
https://github.com/ProxioDev/RedisBungee/wiki
|
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
open an issue with question button
|
open an issue with question button
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ tasks {
|
|||||||
val jedisVersion = libs.jedis.get().version
|
val jedisVersion = libs.jedis.get().version
|
||||||
val configurateVersion = libs.configurate.get().version
|
val configurateVersion = libs.configurate.get().version
|
||||||
val guavaVersion = libs.guava.get().version
|
val guavaVersion = libs.guava.get().version
|
||||||
val adventureVersion = libs.adventure.plain.get().version
|
val adventureVersion = libs.guava.get().version
|
||||||
options.links(
|
options.links(
|
||||||
"https://configurate.aoeu.xyz/$configurateVersion/apidocs/", // configurate
|
"https://configurate.aoeu.xyz/$configurateVersion/apidocs/", // configurate
|
||||||
"https://javadoc.io/doc/redis.clients/jedis/$jedisVersion/", // jedis
|
"https://javadoc.io/doc/redis.clients/jedis/$jedisVersion/", // jedis
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ public abstract class AbstractRedisBungeeAPI {
|
|||||||
if (getMode() == RedisBungeeMode.SINGLE) {
|
if (getMode() == RedisBungeeMode.SINGLE) {
|
||||||
JedisPool jedisPool = ((JedisPooledSummoner) this.plugin.getSummoner()).getCompatibilityJedisPool();
|
JedisPool jedisPool = ((JedisPooledSummoner) this.plugin.getSummoner()).getCompatibilityJedisPool();
|
||||||
if (jedisPool == null) {
|
if (jedisPool == null) {
|
||||||
throw new IllegalStateException("JedisPool compatibility mode is disabled, Please enable it in the RedisBungee config.yml");
|
throw new IllegalStateException("JedisPool compatibility mode is disabled");
|
||||||
}
|
}
|
||||||
return jedisPool;
|
return jedisPool;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -37,10 +37,11 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public abstract class PlayerDataManager<P, LE, DE, PS extends IPubSubMessageEvent, SC extends IPlayerChangedServerNetworkEvent, NJE extends IPlayerLeftNetworkEvent, CE> {
|
public abstract class PlayerDataManager<P, LE, DE, PS extends IPubSubMessageEvent, SC extends IPlayerChangedServerNetworkEvent, NJE extends IPlayerLeftNetworkEvent, CE> {
|
||||||
|
|
||||||
protected final RedisBungeePlugin<P> plugin;
|
protected final RedisBungeePlugin<P> plugin;
|
||||||
private final LoadingCache<UUID, String> serverCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build(this::getServerFromRedis);
|
private final LoadingCache<UUID, String> serverCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getServerFromRedis);
|
||||||
private final LoadingCache<UUID, String> lastServerCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build(this::getLastServerFromRedis);
|
private final LoadingCache<UUID, String> lastServerCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getLastServerFromRedis);
|
||||||
private final LoadingCache<UUID, String> proxyCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build(this::getProxyFromRedis);
|
private final LoadingCache<UUID, String> proxyCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getProxyFromRedis);
|
||||||
private final LoadingCache<UUID, InetAddress> ipCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build(this::getIpAddressFromRedis);
|
private final LoadingCache<UUID, InetAddress> ipCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getIpAddressFromRedis);
|
||||||
|
private final LoadingCache<UUID, Long> lastOnlineCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getLastOnlineFromRedis);
|
||||||
private final Object SERVERS_TO_PLAYERS_KEY = new Object();
|
private final Object SERVERS_TO_PLAYERS_KEY = new Object();
|
||||||
private final LoadingCache<Object, Multimap<String, UUID>> serverToPlayersCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES).build(this::serversToPlayersBuilder);
|
private final LoadingCache<Object, Multimap<String, UUID>> serverToPlayersCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES).build(this::serversToPlayersBuilder);
|
||||||
private final UnifiedJedis unifiedJedis;
|
private final UnifiedJedis unifiedJedis;
|
||||||
@@ -79,6 +80,7 @@ public abstract class PlayerDataManager<P, LE, DE, PS extends IPubSubMessageEven
|
|||||||
this.proxyCache.invalidate(event.getUuid());
|
this.proxyCache.invalidate(event.getUuid());
|
||||||
this.serverCache.invalidate(event.getUuid());
|
this.serverCache.invalidate(event.getUuid());
|
||||||
this.ipCache.invalidate(event.getUuid());
|
this.ipCache.invalidate(event.getUuid());
|
||||||
|
this.lastOnlineCache.invalidate(event.getUuid());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handlePubSubMessageEvent(IPubSubMessageEvent event) {
|
protected void handlePubSubMessageEvent(IPubSubMessageEvent event) {
|
||||||
@@ -159,13 +161,13 @@ public abstract class PlayerDataManager<P, LE, DE, PS extends IPubSubMessageEven
|
|||||||
unifiedJedis.hset("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", data);
|
unifiedJedis.hset("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addPlayer(final UUID uuid, final String name, final InetAddress inetAddress) {
|
protected void addPlayer(final UUID uuid, final InetAddress inetAddress) {
|
||||||
Map<String, String> redisData = new HashMap<>();
|
Map<String, String> redisData = new HashMap<>();
|
||||||
redisData.put("last-online", String.valueOf(0));
|
redisData.put("last-online", String.valueOf(0));
|
||||||
redisData.put("proxy", this.proxyId);
|
redisData.put("proxy", this.proxyId);
|
||||||
redisData.put("ip", inetAddress.getHostAddress());
|
redisData.put("ip", inetAddress.getHostAddress());
|
||||||
unifiedJedis.hset("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", redisData);
|
unifiedJedis.hset("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", redisData);
|
||||||
plugin.getUuidTranslator().persistInfo(name, uuid, this.unifiedJedis);
|
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
data.put("proxy", this.proxyId);
|
data.put("proxy", this.proxyId);
|
||||||
data.put("uuid", uuid);
|
data.put("uuid", uuid);
|
||||||
@@ -226,7 +228,7 @@ public abstract class PlayerDataManager<P, LE, DE, PS extends IPubSubMessageEven
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long getLastOnline(UUID uuid) {
|
public long getLastOnline(UUID uuid) {
|
||||||
return getLastOnlineFromRedis(uuid);
|
return this.lastOnlineCache.get(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Multimap<String, UUID> serversToPlayers() {
|
public Multimap<String, UUID> serversToPlayers() {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class InitialUtils {
|
|||||||
}
|
}
|
||||||
long uuidCacheSize = unifiedJedis.hlen("uuid-cache");
|
long uuidCacheSize = unifiedJedis.hlen("uuid-cache");
|
||||||
if (uuidCacheSize > 750000) {
|
if (uuidCacheSize > 750000) {
|
||||||
plugin.logInfo("Looks like you have a really big UUID cache! Run '/rb clean' to remove expired cache entries");
|
plugin.logInfo("Looks like you have a really big UUID cache! Run https://github.com/ProxioDev/Brains");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class BungeePlayerDataManager extends PlayerDataManager<ProxiedPlayer, Po
|
|||||||
@Override
|
@Override
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLoginEvent(PostLoginEvent event) {
|
public void onLoginEvent(PostLoginEvent event) {
|
||||||
super.addPlayer(event.getPlayer().getUniqueId(), event.getPlayer().getName(), event.getPlayer().getAddress().getAddress());
|
super.addPlayer(event.getPlayer().getUniqueId(), event.getPlayer().getAddress().getAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
`java-library`
|
`java-library`
|
||||||
`maven-publish`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -23,11 +22,3 @@ tasks {
|
|||||||
filteringCharset = Charsets.UTF_8.name()
|
filteringCharset = Charsets.UTF_8.name()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
create<MavenPublication>("maven") {
|
|
||||||
from(components["java"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -84,7 +84,7 @@ public class VelocityPlayerDataManager extends PlayerDataManager<Player, PostLog
|
|||||||
@Override
|
@Override
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onLoginEvent(PostLoginEvent event) {
|
public void onLoginEvent(PostLoginEvent event) {
|
||||||
addPlayer(event.getPlayer().getUniqueId(), event.getPlayer().getUsername(), event.getPlayer().getRemoteAddress().getAddress());
|
addPlayer(event.getPlayer().getUniqueId(), event.getPlayer().getRemoteAddress().getAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
group=com.imaginarycode.minecraft
|
group=com.imaginarycode.minecraft
|
||||||
version=0.12.2
|
version=0.12.0
|
||||||
|
|||||||
Reference in New Issue
Block a user