mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-05-03 11:40:29 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
2485150ddc
|
|||
|
32735466d6
|
|||
|
e8715e5399
|
|||
|
71287055b4
|
|||
|
8b48736bc1
|
|||
|
a2e6aff4c2
|
|||
|
7c1c1183cf
|
|||
|
7f35b64d93
|
|||
|
3dc3d80045
|
|||
|
765e6fe122
|
|||
|
e8514b3e8b
|
|||
|
e1d401639e
|
|||
|
f8c304d441
|
|||
|
e6b789229c
|
|||
|
025b555457
|
|||
|
7029552c02
|
|||
|
62007992a7
|
6
.github/workflows/gradle.yml
vendored
6
.github/workflows/gradle.yml
vendored
@@ -29,14 +29,14 @@ jobs:
|
|||||||
# Artifact name
|
# Artifact name
|
||||||
name: RedisBungee-Bungee
|
name: RedisBungee-Bungee
|
||||||
# Destination path
|
# Destination path
|
||||||
path: RedisBungee-Bungee/build/libs/*
|
path: proxies/bungeecord/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: RedisBungee-Velocity/build/libs/*
|
path: proxies/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: RedisBungee-API/build/libs/*
|
path: api/build/libs/*
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -46,4 +46,4 @@ manifest.mf
|
|||||||
javadoc
|
javadoc
|
||||||
|
|
||||||
# run-server folders
|
# run-server folders
|
||||||
*/run
|
proxies/*/run
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ public abstract class AbstractRedisBungeeAPI {
|
|||||||
* @since 0.2.5
|
* @since 0.2.5
|
||||||
* @deprecated to avoid confusion between A server and A proxy see #getProxyId()
|
* @deprecated to avoid confusion between A server and A proxy see #getProxyId()
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated(forRemoval = true)
|
||||||
public final String getServerId() {
|
public final String getServerId() {
|
||||||
return getProxyId();
|
return getProxyId();
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ public abstract class AbstractRedisBungeeAPI {
|
|||||||
* @since 0.2.5
|
* @since 0.2.5
|
||||||
* @deprecated to avoid confusion between A server and A proxy see see {@link #getAllProxies()}
|
* @deprecated to avoid confusion between A server and A proxy see see {@link #getAllProxies()}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated(forRemoval = true)
|
||||||
public final List<String> getAllServers() {
|
public final List<String> getAllServers() {
|
||||||
return getAllProxies();
|
return getAllProxies();
|
||||||
}
|
}
|
||||||
@@ -260,7 +260,7 @@ public abstract class AbstractRedisBungeeAPI {
|
|||||||
* @since 0.3
|
* @since 0.3
|
||||||
* @deprecated No longer required
|
* @deprecated No longer required
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated(forRemoval = true)
|
||||||
public final void registerPubSubChannels(String... channels) {
|
public final void registerPubSubChannels(String... channels) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +271,7 @@ public abstract class AbstractRedisBungeeAPI {
|
|||||||
* @since 0.3
|
* @since 0.3
|
||||||
* @deprecated No longer required
|
* @deprecated No longer required
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated(forRemoval = true)
|
||||||
public final void unregisterPubSubChannels(String... channels) {
|
public final void unregisterPubSubChannels(String... channels) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +352,7 @@ public abstract class AbstractRedisBungeeAPI {
|
|||||||
* @since 0.8.0
|
* @since 0.8.0
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated(forRemoval = true)
|
||||||
public void kickPlayer(String playerName, String message) {
|
public void kickPlayer(String playerName, String message) {
|
||||||
kickPlayer(getUuidFromName(playerName), message);
|
kickPlayer(getUuidFromName(playerName), message);
|
||||||
}
|
}
|
||||||
@@ -365,7 +365,7 @@ public abstract class AbstractRedisBungeeAPI {
|
|||||||
* @since 0.8.0
|
* @since 0.8.0
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated(forRemoval = true)
|
||||||
public void kickPlayer(UUID playerUUID, String message) {
|
public void kickPlayer(UUID playerUUID, String message) {
|
||||||
kickPlayer(playerUUID, Component.text(message));
|
kickPlayer(playerUUID, Component.text(message));
|
||||||
}
|
}
|
||||||
@@ -402,7 +402,9 @@ public abstract class AbstractRedisBungeeAPI {
|
|||||||
* @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#SINGLE}
|
* @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#SINGLE}
|
||||||
* @see #getJedisPool()
|
* @see #getJedisPool()
|
||||||
* @since 0.7.0
|
* @since 0.7.0
|
||||||
|
* @deprecated use {@link #getSummoner() }
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
public Jedis requestJedis() {
|
public Jedis requestJedis() {
|
||||||
if (getMode() == RedisBungeeMode.SINGLE) {
|
if (getMode() == RedisBungeeMode.SINGLE) {
|
||||||
return getJedisPool().getResource();
|
return getJedisPool().getResource();
|
||||||
@@ -423,7 +425,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");
|
throw new IllegalStateException("JedisPool compatibility mode is disabled, Please enable it in the RedisBungee config.yml");
|
||||||
}
|
}
|
||||||
return jedisPool;
|
return jedisPool;
|
||||||
} else {
|
} else {
|
||||||
@@ -438,7 +440,9 @@ public abstract class AbstractRedisBungeeAPI {
|
|||||||
* @return {@link redis.clients.jedis.JedisCluster}
|
* @return {@link redis.clients.jedis.JedisCluster}
|
||||||
* @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#CLUSTER}
|
* @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#CLUSTER}
|
||||||
* @since 0.8.0
|
* @since 0.8.0
|
||||||
|
* @deprecated use {@link #getSummoner()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
public JedisCluster requestClusterJedis() {
|
public JedisCluster requestClusterJedis() {
|
||||||
if (getMode() == RedisBungeeMode.CLUSTER) {
|
if (getMode() == RedisBungeeMode.CLUSTER) {
|
||||||
return ((JedisClusterSummoner) this.plugin.getSummoner()).obtainResource();
|
return ((JedisClusterSummoner) this.plugin.getSummoner()).obtainResource();
|
||||||
@@ -454,7 +458,9 @@ public abstract class AbstractRedisBungeeAPI {
|
|||||||
* @return {@link redis.clients.jedis.JedisPooled}
|
* @return {@link redis.clients.jedis.JedisPooled}
|
||||||
* @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#SINGLE}
|
* @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#SINGLE}
|
||||||
* @since 0.8.0
|
* @since 0.8.0
|
||||||
|
* @deprecated use {@link #getSummoner()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
public JedisPooled requestJedisPooled() {
|
public JedisPooled requestJedisPooled() {
|
||||||
if (getMode() == RedisBungeeMode.SINGLE) {
|
if (getMode() == RedisBungeeMode.SINGLE) {
|
||||||
return ((JedisPooledSummoner) this.plugin.getSummoner()).obtainResource();
|
return ((JedisPooledSummoner) this.plugin.getSummoner()).obtainResource();
|
||||||
@@ -37,11 +37,10 @@ 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.HOURS).build(this::getServerFromRedis);
|
private final LoadingCache<UUID, String> serverCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build(this::getServerFromRedis);
|
||||||
private final LoadingCache<UUID, String> lastServerCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getLastServerFromRedis);
|
private final LoadingCache<UUID, String> lastServerCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build(this::getLastServerFromRedis);
|
||||||
private final LoadingCache<UUID, String> proxyCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getProxyFromRedis);
|
private final LoadingCache<UUID, String> proxyCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build(this::getProxyFromRedis);
|
||||||
private final LoadingCache<UUID, InetAddress> ipCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getIpAddressFromRedis);
|
private final LoadingCache<UUID, InetAddress> ipCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).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;
|
||||||
@@ -80,7 +79,6 @@ 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) {
|
||||||
@@ -228,7 +226,7 @@ public abstract class PlayerDataManager<P, LE, DE, PS extends IPubSubMessageEven
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long getLastOnline(UUID uuid) {
|
public long getLastOnline(UUID uuid) {
|
||||||
return this.lastOnlineCache.get(uuid);
|
return getLastOnlineFromRedis(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Multimap<String, UUID> serversToPlayers() {
|
public Multimap<String, UUID> serversToPlayers() {
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
group=com.imaginarycode.minecraft
|
group=com.imaginarycode.minecraft
|
||||||
version=0.12.1
|
version=0.12.3
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
plugins {
|
plugins {
|
||||||
`java-library`
|
java
|
||||||
`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 {
|
||||||
api(project(":RedisBungee-API"))
|
implementation(project(":RedisBungee-Bungee"))
|
||||||
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")
|
||||||
@@ -21,23 +20,10 @@ 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"
|
||||||
@@ -47,9 +33,6 @@ 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") {
|
||||||
@@ -81,11 +64,3 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
create<MavenPublication>("maven") {
|
|
||||||
from(components["java"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
50
proxies/bungeecord/bungeecord-api/build.gradle.kts
Normal file
50
proxies/bungeecord/bungeecord-api/build.gradle.kts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
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,25 +1,11 @@
|
|||||||
plugins {
|
plugins {
|
||||||
`java-library`
|
java
|
||||||
`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 {
|
||||||
api(project(":RedisBungee-API")) {
|
implementation(project(":RedisBungee-Velocity"))
|
||||||
// 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"))
|
||||||
@@ -30,22 +16,10 @@ 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"
|
||||||
@@ -55,9 +29,6 @@ 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()
|
||||||
}
|
}
|
||||||
@@ -75,10 +46,3 @@ tasks {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
create<MavenPublication>("maven") {
|
|
||||||
from(components["java"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -26,7 +26,6 @@ import com.velocitypowered.api.proxy.Player;
|
|||||||
import com.velocitypowered.api.proxy.ServerConnection;
|
import com.velocitypowered.api.proxy.ServerConnection;
|
||||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||||
import com.velocitypowered.api.proxy.server.ServerPing;
|
import com.velocitypowered.api.proxy.server.ServerPing;
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -146,8 +145,11 @@ public class RedisBungeeListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
((ServerConnection) event.getSource()).sendPluginMessage(event.getIdentifier(), out.toByteArray());
|
// ServerConnection throws IllegalStateException when connection dies somehow so just ignore :/
|
||||||
|
((ServerConnection) event.getSource()).sendPluginMessage(event.getIdentifier(), out.toByteArray());
|
||||||
|
} catch (IllegalStateException ignored) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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 {
|
public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, ConfigLoader, LangConfigLoader, ServerObjectFetcher {
|
||||||
private final ProxyServer server;
|
private final ProxyServer server;
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
private final Path dataFolder;
|
private final Path dataFolder;
|
||||||
61
proxies/velocity/velocity-api/build.gradle.kts
Normal file
61
proxies/velocity/velocity-api/build.gradle.kts
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
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"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 ((RedisBungeeVelocityPlugin) this.plugin).getProxy().getServer(serverName).map((RegisteredServer::getServerInfo)).orElse(null);
|
return ((ServerObjectFetcher) this.plugin).getProxy().getServer(serverName).map((RegisteredServer::getServerInfo)).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.imaginarycode.minecraft.redisbungee;
|
||||||
|
|
||||||
|
import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
|
|
||||||
|
public interface ServerObjectFetcher {
|
||||||
|
|
||||||
|
ProxyServer getProxy();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,12 +4,31 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "RedisBungee-Parent"
|
rootProject.name = "ValioBungee"
|
||||||
|
|
||||||
|
include(":RedisBungee-API")
|
||||||
|
project(":RedisBungee-API").projectDir = file("api")
|
||||||
|
|
||||||
|
include(":RedisBungee-Commands")
|
||||||
|
project(":RedisBungee-Commands").projectDir = file("commands")
|
||||||
|
|
||||||
include(":RedisBungee-Velocity")
|
include(":RedisBungee-Velocity")
|
||||||
include(":RedisBungee-Commands")
|
project(":RedisBungee-Velocity").projectDir = file("proxies/velocity")
|
||||||
|
|
||||||
include(":RedisBungee-Bungee")
|
include(":RedisBungee-Bungee")
|
||||||
include(":RedisBungee-API")
|
project(":RedisBungee-Bungee").projectDir = file("proxies/bungeecord/bungeecord-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 {
|
||||||
@@ -73,4 +92,4 @@ dependencyResolutionManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user