mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-05-03 11:40:29 +00:00
Compare commits
69 Commits
0.12.3-SNA
...
d0ae5d5342
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 |
10
.github/workflows/gradle.yml
vendored
10
.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:
|
||||||
@@ -29,14 +29,14 @@ jobs:
|
|||||||
# Artifact name
|
# Artifact name
|
||||||
name: RedisBungee-Bungee
|
name: RedisBungee-Bungee
|
||||||
# Destination path
|
# Destination path
|
||||||
path: proxies/bungeecord/build/libs/*
|
path: RedisBungee-Bungee/build/libs/*
|
||||||
- name: Upload Velocity
|
- name: Upload Velocity
|
||||||
uses: actions/upload-artifact@v2.2.3
|
uses: actions/upload-artifact@v2.2.3
|
||||||
with:
|
with:
|
||||||
name: RedisBungee-Velocity
|
name: RedisBungee-Velocity
|
||||||
path: proxies/velocity/build/libs/*
|
path: RedisBungee-Velocity/build/libs/*
|
||||||
- name: Upload API
|
- name: Upload API
|
||||||
uses: actions/upload-artifact@v2.2.3
|
uses: actions/upload-artifact@v2.2.3
|
||||||
with:
|
with:
|
||||||
name: RedisBungee-API
|
name: RedisBungee-API
|
||||||
path: api/build/libs/*
|
path: RedisBungee-API/build/libs/*
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -46,4 +46,4 @@ manifest.mf
|
|||||||
javadoc
|
javadoc
|
||||||
|
|
||||||
# run-server folders
|
# run-server folders
|
||||||
proxies/*/run
|
*/run
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ blossom {
|
|||||||
commit = "$commitStdout".replace("\n", "") // for some reason it adds new line so remove it.
|
commit = "$commitStdout".replace("\n", "") // for some reason it adds new line so remove it.
|
||||||
commitStdout.close()
|
commitStdout.close()
|
||||||
replaceToken("@git_commit@", commit)
|
replaceToken("@git_commit@", commit)
|
||||||
|
replaceToken("@build_date@", "${Instant.now().epochSecond}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +53,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 {
|
||||||
@@ -15,6 +15,7 @@ public class Constants {
|
|||||||
|
|
||||||
public final static String VERSION = "@version@";
|
public final static String VERSION = "@version@";
|
||||||
public final static String GIT_COMMIT = "@git_commit@";
|
public final static String GIT_COMMIT = "@git_commit@";
|
||||||
|
public final static long BUILD_DATE = Long.parseLong("@build_date@");
|
||||||
|
|
||||||
public static String getGithubCommitLink() {
|
public static String getGithubCommitLink() {
|
||||||
return "https://github.com/ProxioDev/RedisBungee/commit/" + GIT_COMMIT;
|
return "https://github.com/ProxioDev/RedisBungee/commit/" + GIT_COMMIT;
|
||||||
@@ -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() {
|
||||||
@@ -12,6 +12,7 @@ package com.imaginarycode.minecraft.redisbungee.api.config.loaders;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ network-id: "main"
|
|||||||
# You can set Environment variable 'REDISBUNGEE_PROXY_ID' to override
|
# You can set Environment variable 'REDISBUNGEE_PROXY_ID' to override
|
||||||
proxy-id: "proxy-1"
|
proxy-id: "proxy-1"
|
||||||
|
|
||||||
# since RedisBungee Internally now uses UnifiedJedis instead of Jedis, JedisPool.
|
# since RedisBungee Internally now uses JedisPooled instead of Jedis, JedisPool.
|
||||||
# which will break compatibility with old plugins that uses RedisBungee JedisPool
|
# which will break compatibility with old plugins that uses RedisBungee JedisPool
|
||||||
# so to mitigate this issue, RedisBungee will create an JedisPool for compatibility reasons.
|
# so to mitigate this issue, RedisBungee will create an JedisPool for compatibility reasons.
|
||||||
# disabled by default
|
# disabled by default
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
plugins {
|
plugins {
|
||||||
java
|
`java-library`
|
||||||
|
`maven-publish`
|
||||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||||
id("xyz.jpenilla.run-waterfall") version "2.0.0"
|
id("xyz.jpenilla.run-waterfall") version "2.0.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":RedisBungee-Bungee"))
|
api(project(":RedisBungee-API"))
|
||||||
compileOnly(libs.platform.bungeecord) {
|
compileOnly(libs.platform.bungeecord) {
|
||||||
exclude("com.google.guava", "guava")
|
exclude("com.google.guava", "guava")
|
||||||
exclude("com.google.code.gson", "gson")
|
exclude("com.google.code.gson", "gson")
|
||||||
@@ -20,10 +21,23 @@ dependencies {
|
|||||||
description = "RedisBungee Bungeecord implementation"
|
description = "RedisBungee Bungeecord implementation"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
|
withJavadocJar()
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
withType<Javadoc> {
|
||||||
|
dependsOn(project(":RedisBungee-API").getTasksByName("javadoc", false))
|
||||||
|
val options = options as StandardJavadocDocletOptions
|
||||||
|
options.use()
|
||||||
|
options.isDocFilesSubDirs = true
|
||||||
|
options.links(
|
||||||
|
"https://ci.md-5.net/job/BungeeCord/ws/api/target/apidocs/", // bungeecord api
|
||||||
|
)
|
||||||
|
val apiDocs = File(rootProject.projectDir, "RedisBungee-API/build/docs/javadoc")
|
||||||
|
options.linksOffline("https://ci.limework.net/RedisBungee/RedisBungee-API/build/docs/javadoc", apiDocs.path)
|
||||||
|
}
|
||||||
runWaterfall {
|
runWaterfall {
|
||||||
waterfallVersion("1.20")
|
waterfallVersion("1.20")
|
||||||
environment["REDISBUNGEE_PROXY_ID"] = "bungeecord-1"
|
environment["REDISBUNGEE_PROXY_ID"] = "bungeecord-1"
|
||||||
@@ -33,6 +47,9 @@ tasks {
|
|||||||
options.encoding = Charsets.UTF_8.name()
|
options.encoding = Charsets.UTF_8.name()
|
||||||
options.release.set(17)
|
options.release.set(17)
|
||||||
}
|
}
|
||||||
|
javadoc {
|
||||||
|
options.encoding = Charsets.UTF_8.name()
|
||||||
|
}
|
||||||
processResources {
|
processResources {
|
||||||
filteringCharset = Charsets.UTF_8.name()
|
filteringCharset = Charsets.UTF_8.name()
|
||||||
filesMatching("plugin.yml") {
|
filesMatching("plugin.yml") {
|
||||||
@@ -64,3 +81,11 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("maven") {
|
||||||
|
from(components["java"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -197,6 +197,7 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
|
|||||||
public void initialize() {
|
public void initialize() {
|
||||||
logInfo("Initializing RedisBungee.....");
|
logInfo("Initializing RedisBungee.....");
|
||||||
logInfo("Version: {}", Constants.VERSION);
|
logInfo("Version: {}", Constants.VERSION);
|
||||||
|
logInfo("Build date: {}", Date.from(Instant.ofEpochSecond(Constants.BUILD_DATE)));
|
||||||
ThreadFactory factory = ((ThreadPoolExecutor) getExecutorService()).getThreadFactory();
|
ThreadFactory factory = ((ThreadPoolExecutor) getExecutorService()).getThreadFactory();
|
||||||
ScheduledExecutorService service = Executors.newScheduledThreadPool(24, factory);
|
ScheduledExecutorService service = Executors.newScheduledThreadPool(24, factory);
|
||||||
try {
|
try {
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
package com.imaginarycode.minecraft.redisbungee.commands;
|
package com.imaginarycode.minecraft.redisbungee.commands;
|
||||||
|
|
||||||
import co.aikar.commands.CommandIssuer;
|
import co.aikar.commands.CommandIssuer;
|
||||||
import co.aikar.commands.RegisteredCommand;
|
|
||||||
import co.aikar.commands.annotation.*;
|
import co.aikar.commands.annotation.*;
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import com.imaginarycode.minecraft.redisbungee.Constants;
|
import com.imaginarycode.minecraft.redisbungee.Constants;
|
||||||
@@ -27,12 +26,12 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
|
|||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@CommandAlias("rb|redisbungee")
|
@CommandAlias("rb|redisbungee")
|
||||||
@CommandPermission("redisbungee.command.use")
|
@CommandPermission("redisbungee.command.use")
|
||||||
@Description("Main command")
|
|
||||||
public class CommandRedisBungee extends AdventureBaseCommand {
|
public class CommandRedisBungee extends AdventureBaseCommand {
|
||||||
|
|
||||||
private final RedisBungeePlugin<?> plugin;
|
private final RedisBungeePlugin<?> plugin;
|
||||||
@@ -43,12 +42,12 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||||||
|
|
||||||
@Default
|
@Default
|
||||||
@Subcommand("info|version|git")
|
@Subcommand("info|version|git")
|
||||||
@Description("information about current redisbungee build")
|
|
||||||
public void info(CommandIssuer issuer) {
|
public void info(CommandIssuer issuer) {
|
||||||
final String message = """
|
final String message = """
|
||||||
<color:aqua>This proxy is running RedisBungee Limework's fork
|
<color:aqua>This proxy is running RedisBungee Limework's fork
|
||||||
<color:gold>========================================
|
<color:gold>========================================
|
||||||
<color:aqua>RedisBungee version: <color:green><version>
|
<color:aqua>RedisBungee version: <color:green><version>
|
||||||
|
<color:aqua>Build date: <color:green><build-date>
|
||||||
<color:aqua>Commit: <color:green><commit>
|
<color:aqua>Commit: <color:green><commit>
|
||||||
<color:gold>========================================
|
<color:gold>========================================
|
||||||
<color:gold>run /rb help for more commands""";
|
<color:gold>run /rb help for more commands""";
|
||||||
@@ -58,6 +57,7 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||||||
.deserialize(
|
.deserialize(
|
||||||
message,
|
message,
|
||||||
Placeholder.component("version", Component.text(Constants.VERSION)),
|
Placeholder.component("version", Component.text(Constants.VERSION)),
|
||||||
|
Placeholder.component("build-date", Component.text( new Date(Constants.BUILD_DATE * 1000).toString() )),
|
||||||
Placeholder.component(
|
Placeholder.component(
|
||||||
"commit",
|
"commit",
|
||||||
Component.text(Constants.GIT_COMMIT.substring(0, 8))
|
Component.text(Constants.GIT_COMMIT.substring(0, 8))
|
||||||
@@ -67,29 +67,19 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||||||
}
|
}
|
||||||
// <color:aqua>......: <color:green>......
|
// <color:aqua>......: <color:green>......
|
||||||
@HelpCommand
|
@HelpCommand
|
||||||
@Description("shows the help page")
|
|
||||||
public void help(CommandIssuer issuer) {
|
public void help(CommandIssuer issuer) {
|
||||||
final String barFormat = "<color:gold>========================================";
|
final String message = """
|
||||||
final String commandFormat = "<color:aqua>/rb <sub-command>: <color:green><description>";
|
<color:gold>========================================
|
||||||
|
<color:aqua>/rb info: <color:green>shows info of this version.
|
||||||
TextComponent.Builder message = Component.text();
|
<color:aqua>/rb help: <color:green>shows this page.
|
||||||
message.append(MiniMessage.miniMessage().deserialize(barFormat));
|
<color:aqua>/rb clean: <color:green>cleans up the uuid cache
|
||||||
|
<color:red><bold>WARNING...</bold> <color:white>command above could cause performance issues
|
||||||
getSubCommands().forEach((subCommand, registeredCommand) -> {
|
<color:aqua>/rb show: <color:green>shows list of proxies with player count
|
||||||
String[] split = registeredCommand.getCommand().split(" ");
|
<color:gold>========================================
|
||||||
if (split.length > 1 && subCommand.equalsIgnoreCase(split[1])) {
|
<color:gold>run /rb help for more commands""";
|
||||||
message.appendNewline().append(MiniMessage.miniMessage().deserialize(commandFormat, Placeholder.component("sub-command", Component.text(subCommand)),
|
sendMessage(issuer, MiniMessage.miniMessage().deserialize(message));
|
||||||
Placeholder.component("description", MiniMessage.miniMessage().deserialize(registeredCommand.getHelpText()))
|
|
||||||
));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
message.appendNewline().append(MiniMessage.miniMessage().deserialize(barFormat));
|
|
||||||
|
|
||||||
sendMessage(issuer, message.build());
|
|
||||||
}
|
}
|
||||||
@Subcommand("clean")
|
@Subcommand("clean")
|
||||||
@Description("cleans up the uuid cache<color:red> <bold>WARNING...</bold> <color:white>command above could cause performance issues")
|
|
||||||
@Private
|
@Private
|
||||||
public void cleanUp(CommandIssuer issuer) {
|
public void cleanUp(CommandIssuer issuer) {
|
||||||
if (StopperUUIDCleanupTask.isRunning) {
|
if (StopperUUIDCleanupTask.isRunning) {
|
||||||
@@ -109,7 +99,6 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||||||
|
|
||||||
}
|
}
|
||||||
@Subcommand("show")
|
@Subcommand("show")
|
||||||
@Description("Shows proxies in this network")
|
|
||||||
public void showProxies(CommandIssuer issuer, String[] args) {
|
public void showProxies(CommandIssuer issuer, String[] args) {
|
||||||
final String closer = "<color:gold>========================================";
|
final String closer = "<color:gold>========================================";
|
||||||
final String pageTop = "<color:yellow>Page: <color:green><current>/<max> <color:yellow>Network ID: <color:green><network> <color:yellow>Proxies online: <color:green><proxies>";
|
final String pageTop = "<color:yellow>Page: <color:green><current>/<max> <color:yellow>Network ID: <color:green><network> <color:yellow>Proxies online: <color:green><proxies>";
|
||||||
@@ -134,6 +123,15 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||||||
} else currentPage = 1;
|
} else currentPage = 1;
|
||||||
|
|
||||||
var data = new ArrayList<>(plugin.proxyDataManager().eachProxyCount().entrySet());
|
var data = new ArrayList<>(plugin.proxyDataManager().eachProxyCount().entrySet());
|
||||||
|
data.addAll(data);
|
||||||
|
data.addAll(data);
|
||||||
|
data.addAll(data);
|
||||||
|
data.addAll(data);
|
||||||
|
data.addAll(data);
|
||||||
|
data.addAll(data);
|
||||||
|
data.addAll(data);
|
||||||
|
data.addAll(data);
|
||||||
|
|
||||||
// there is no way this runs because there is always an heartbeat.
|
// there is no way this runs because there is always an heartbeat.
|
||||||
// if not could be some shenanigans done by devs :P
|
// if not could be some shenanigans done by devs :P
|
||||||
if (data.isEmpty()) {
|
if (data.isEmpty()) {
|
||||||
@@ -141,7 +139,7 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// compute the total pages
|
// compute the total pages
|
||||||
int maxPages = (int) Math.ceil(data.size() / (double) pageSize);
|
int maxPages = data.size() < pageSize ? 1 : data.size() / pageSize ;
|
||||||
if (currentPage > maxPages) currentPage = maxPages;
|
if (currentPage > maxPages) currentPage = maxPages;
|
||||||
var subList = subListProxies(data, currentPage, pageSize);
|
var subList = subListProxies(data, currentPage, pageSize);
|
||||||
TextComponent.Builder builder = Component.text();
|
TextComponent.Builder builder = Component.text();
|
||||||
@@ -171,19 +169,17 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||||||
}
|
}
|
||||||
if (currentPage > 1) {
|
if (currentPage > 1) {
|
||||||
builder.append(MiniMessage.miniMessage().deserialize(previousPage)
|
builder.append(MiniMessage.miniMessage().deserialize(previousPage)
|
||||||
.color(NamedTextColor.WHITE).clickEvent(ClickEvent.runCommand("/rb show " + (currentPage - 1))));
|
.clickEvent(ClickEvent.runCommand("/rb show " + (currentPage - 1))));
|
||||||
} else {
|
|
||||||
builder.append(MiniMessage.miniMessage().deserialize(previousPage).color(NamedTextColor.GRAY));
|
|
||||||
}
|
}
|
||||||
if (subList.size() == pageSize && !subListProxies(data, currentPage + 1, pageSize).isEmpty()) {
|
if (subList.size() == pageSize && !subListProxies(data, currentPage + 1, pageSize).isEmpty()) {
|
||||||
builder.append(MiniMessage.miniMessage().deserialize(nextPage)
|
builder.append(MiniMessage.miniMessage().deserialize(nextPage)
|
||||||
.color(NamedTextColor.WHITE).clickEvent(ClickEvent.runCommand("/rb show " + (currentPage + 1))));
|
.clickEvent(ClickEvent.runCommand("/rb show " + (currentPage + 1))));
|
||||||
} else {
|
|
||||||
builder.append(MiniMessage.miniMessage().deserialize(nextPage).color(NamedTextColor.GRAY));
|
|
||||||
}
|
}
|
||||||
builder.appendNewline();
|
builder.appendNewline();
|
||||||
builder.append(MiniMessage.miniMessage().deserialize(closer));
|
builder.append(MiniMessage.miniMessage().deserialize(closer));
|
||||||
sendMessage(issuer, builder.build());
|
sendMessage(issuer, builder.build());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,25 @@
|
|||||||
plugins {
|
plugins {
|
||||||
java
|
`java-library`
|
||||||
|
`maven-publish`
|
||||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||||
id("xyz.jpenilla.run-velocity") version "2.0.0"
|
id("xyz.jpenilla.run-velocity") version "2.0.0"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":RedisBungee-Velocity"))
|
api(project(":RedisBungee-API")) {
|
||||||
|
// Since velocity already includes guava / configurate exlude them
|
||||||
|
exclude("com.google.guava", "guava")
|
||||||
|
exclude("com.google.code.gson", "gson")
|
||||||
|
exclude("org.spongepowered", "configurate-yaml")
|
||||||
|
// exclude also adventure api
|
||||||
|
exclude("net.kyori", "adventure-api")
|
||||||
|
exclude("net.kyori", "adventure-text-serializer-gson")
|
||||||
|
exclude("net.kyori", "adventure-text-serializer-legacy")
|
||||||
|
exclude("net.kyori", "adventure-text-serializer-plain")
|
||||||
|
exclude("net.kyori", "adventure-text-minimessage")
|
||||||
|
}
|
||||||
compileOnly(libs.platform.velocity)
|
compileOnly(libs.platform.velocity)
|
||||||
annotationProcessor(libs.platform.velocity)
|
annotationProcessor(libs.platform.velocity)
|
||||||
implementation(project(":RedisBungee-Commands"))
|
implementation(project(":RedisBungee-Commands"))
|
||||||
@@ -16,10 +30,22 @@ dependencies {
|
|||||||
description = "RedisBungee Velocity implementation"
|
description = "RedisBungee Velocity implementation"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
|
withJavadocJar()
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
withType<Javadoc> {
|
||||||
|
dependsOn(project(":RedisBungee-API").getTasksByName("javadoc", false))
|
||||||
|
val options = options as StandardJavadocDocletOptions
|
||||||
|
options.use()
|
||||||
|
options.isDocFilesSubDirs = true
|
||||||
|
options.links(
|
||||||
|
"https://jd.papermc.io/velocity/3.0.0/", // velocity api
|
||||||
|
)
|
||||||
|
val apiDocs = File(rootProject.projectDir, "RedisBungee-API/build/docs/javadoc")
|
||||||
|
options.linksOffline("https://ci.limework.net/RedisBungee/RedisBungee-API/build/docs/javadoc", apiDocs.path)
|
||||||
|
}
|
||||||
runVelocity {
|
runVelocity {
|
||||||
velocityVersion("3.3.0-SNAPSHOT")
|
velocityVersion("3.3.0-SNAPSHOT")
|
||||||
environment["REDISBUNGEE_PROXY_ID"] = "velocity-1"
|
environment["REDISBUNGEE_PROXY_ID"] = "velocity-1"
|
||||||
@@ -29,6 +55,9 @@ tasks {
|
|||||||
options.encoding = Charsets.UTF_8.name()
|
options.encoding = Charsets.UTF_8.name()
|
||||||
options.release.set(17)
|
options.release.set(17)
|
||||||
}
|
}
|
||||||
|
javadoc {
|
||||||
|
options.encoding = Charsets.UTF_8.name()
|
||||||
|
}
|
||||||
processResources {
|
processResources {
|
||||||
filteringCharset = Charsets.UTF_8.name()
|
filteringCharset = Charsets.UTF_8.name()
|
||||||
}
|
}
|
||||||
@@ -46,3 +75,10 @@ tasks {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("maven") {
|
||||||
|
from(components["java"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,7 +49,7 @@ public class RedisBungeeAPI extends AbstractRedisBungeeAPI {
|
|||||||
public final ServerInfo getServerFor(@NonNull UUID player) {
|
public final ServerInfo getServerFor(@NonNull UUID player) {
|
||||||
String serverName = this.getServerNameFor(player);
|
String serverName = this.getServerNameFor(player);
|
||||||
if (serverName == null) return null;
|
if (serverName == null) return null;
|
||||||
return ((ServerObjectFetcher) this.plugin).getProxy().getServer(serverName).map((RegisteredServer::getServerInfo)).orElse(null);
|
return ((RedisBungeeVelocityPlugin) this.plugin).getProxy().getServer(serverName).map((RegisteredServer::getServerInfo)).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,7 +68,7 @@ import java.util.concurrent.Executors;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@Plugin(id = "redisbungee", name = "RedisBungee", version = Constants.VERSION, url = "https://github.com/ProxioDev/RedisBungee", authors = {"astei", "ProxioDev"})
|
@Plugin(id = "redisbungee", name = "RedisBungee", version = Constants.VERSION, url = "https://github.com/ProxioDev/RedisBungee", authors = {"astei", "ProxioDev"})
|
||||||
public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, ConfigLoader, LangConfigLoader, ServerObjectFetcher {
|
public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, ConfigLoader, LangConfigLoader {
|
||||||
private final ProxyServer server;
|
private final ProxyServer server;
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
private final Path dataFolder;
|
private final Path dataFolder;
|
||||||
@@ -102,6 +102,7 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
|
|||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.dataFolder = dataDirectory;
|
this.dataFolder = dataDirectory;
|
||||||
logInfo("Version: {}", Constants.VERSION);
|
logInfo("Version: {}", Constants.VERSION);
|
||||||
|
logInfo("Build date: {}", Date.from(Instant.ofEpochSecond(Constants.BUILD_DATE)));
|
||||||
try {
|
try {
|
||||||
loadConfig(this, dataDirectory);
|
loadConfig(this, dataDirectory);
|
||||||
loadLangConfig(this, dataDirectory);
|
loadLangConfig(this, dataDirectory);
|
||||||
@@ -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.3-SNAPSHOT
|
version=0.12.0-SNAPSHOT
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
plugins {
|
|
||||||
`java-library`
|
|
||||||
`maven-publish`
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
api(project(":RedisBungee-API"))
|
|
||||||
compileOnly(libs.platform.bungeecord) {
|
|
||||||
exclude("com.google.guava", "guava")
|
|
||||||
exclude("com.google.code.gson", "gson")
|
|
||||||
exclude("net.kyori","adventure-api")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
description = "RedisBungee Bungeecord API"
|
|
||||||
|
|
||||||
java {
|
|
||||||
withJavadocJar()
|
|
||||||
withSourcesJar()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tasks {
|
|
||||||
withType<Javadoc> {
|
|
||||||
dependsOn(project(":RedisBungee-API").getTasksByName("javadoc", false))
|
|
||||||
val options = options as StandardJavadocDocletOptions
|
|
||||||
options.use()
|
|
||||||
options.isDocFilesSubDirs = true
|
|
||||||
options.links(
|
|
||||||
"https://ci.md-5.net/job/BungeeCord/ws/api/target/apidocs/", // bungeecord api
|
|
||||||
)
|
|
||||||
val apiDocs = File(rootProject.projectDir, "api/build/docs/javadoc")
|
|
||||||
options.linksOffline("https://ci.limework.net/ValioBungee/api/build/docs/javadoc", apiDocs.path)
|
|
||||||
}
|
|
||||||
compileJava {
|
|
||||||
options.encoding = Charsets.UTF_8.name()
|
|
||||||
options.release.set(17)
|
|
||||||
}
|
|
||||||
javadoc {
|
|
||||||
options.encoding = Charsets.UTF_8.name()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
create<MavenPublication>("maven") {
|
|
||||||
from(components["java"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
plugins {
|
|
||||||
`java-library`
|
|
||||||
`maven-publish`
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
api(project(":RedisBungee-API")) {
|
|
||||||
// Since velocity already includes guava / configurate exlude them
|
|
||||||
exclude("com.google.guava", "guava")
|
|
||||||
exclude("com.google.code.gson", "gson")
|
|
||||||
exclude("org.spongepowered", "configurate-yaml")
|
|
||||||
// exclude also adventure api
|
|
||||||
exclude("net.kyori", "adventure-api")
|
|
||||||
exclude("net.kyori", "adventure-text-serializer-gson")
|
|
||||||
exclude("net.kyori", "adventure-text-serializer-legacy")
|
|
||||||
exclude("net.kyori", "adventure-text-serializer-plain")
|
|
||||||
exclude("net.kyori", "adventure-text-minimessage")
|
|
||||||
}
|
|
||||||
compileOnly(libs.platform.velocity)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
description = "RedisBungee Velocity API"
|
|
||||||
|
|
||||||
java {
|
|
||||||
withJavadocJar()
|
|
||||||
withSourcesJar()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks {
|
|
||||||
withType<Javadoc> {
|
|
||||||
dependsOn(project(":RedisBungee-API").getTasksByName("javadoc", false))
|
|
||||||
val options = options as StandardJavadocDocletOptions
|
|
||||||
options.use()
|
|
||||||
options.isDocFilesSubDirs = true
|
|
||||||
options.links(
|
|
||||||
"https://jd.papermc.io/velocity/3.0.0/", // velocity api
|
|
||||||
)
|
|
||||||
val apiDocs = File(rootProject.projectDir, "api/build/docs/javadoc")
|
|
||||||
options.linksOffline("https://ci.limework.net/ValioBungee/api/build/docs/javadoc", apiDocs.path)
|
|
||||||
}
|
|
||||||
compileJava {
|
|
||||||
options.encoding = Charsets.UTF_8.name()
|
|
||||||
options.release.set(17)
|
|
||||||
}
|
|
||||||
javadoc {
|
|
||||||
options.encoding = Charsets.UTF_8.name()
|
|
||||||
}
|
|
||||||
processResources {
|
|
||||||
filteringCharset = Charsets.UTF_8.name()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
create<MavenPublication>("maven") {
|
|
||||||
from(components["java"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package com.imaginarycode.minecraft.redisbungee;
|
|
||||||
|
|
||||||
import com.velocitypowered.api.proxy.ProxyServer;
|
|
||||||
|
|
||||||
public interface ServerObjectFetcher {
|
|
||||||
|
|
||||||
ProxyServer getProxy();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -4,31 +4,12 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "ValioBungee"
|
rootProject.name = "RedisBungee-Parent"
|
||||||
|
|
||||||
include(":RedisBungee-API")
|
|
||||||
project(":RedisBungee-API").projectDir = file("api")
|
|
||||||
|
|
||||||
|
include(":RedisBungee-Velocity")
|
||||||
include(":RedisBungee-Commands")
|
include(":RedisBungee-Commands")
|
||||||
project(":RedisBungee-Commands").projectDir = file("commands")
|
|
||||||
|
|
||||||
include(":RedisBungee-Velocity")
|
|
||||||
project(":RedisBungee-Velocity").projectDir = file("proxies/velocity")
|
|
||||||
|
|
||||||
include(":RedisBungee-Bungee")
|
include(":RedisBungee-Bungee")
|
||||||
project(":RedisBungee-Bungee").projectDir = file("proxies/bungeecord/bungeecord-api")
|
include(":RedisBungee-API")
|
||||||
|
|
||||||
include(":RedisBungee-Proxy-Bungee")
|
|
||||||
project(":RedisBungee-Proxy-Bungee").projectDir = file("proxies/bungeecord")
|
|
||||||
|
|
||||||
include(":RedisBungee-Velocity")
|
|
||||||
project(":RedisBungee-Velocity").projectDir = file("proxies/velocity/velocity-api")
|
|
||||||
|
|
||||||
include(":RedisBungee-Proxy-Velocity")
|
|
||||||
project(":RedisBungee-Proxy-Velocity").projectDir = file("proxies/velocity")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
Reference in New Issue
Block a user