From 069fd54e281451dc0b61d38d0839aff54029268b Mon Sep 17 00:00:00 2001 From: xXJanisXx Date: Fri, 27 Mar 2026 12:27:39 +0100 Subject: [PATCH 1/5] chore: bump dependencies --- gradle/libs.versions.toml | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7abf4c9..4a9e6b3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,10 +2,10 @@ kotlin = "2.2.20" kotlin-coroutines = "1.10.2" -shadow = "9.3.2" -minotaur = "2.8.10" +shadow = "9.4.1" +minotaur = "2.9.0" -simplecloud-api = "0.1.0-platform.20-dev.1771710355025-becd984" +simplecloud-api = "0.1.0-platform.22-dev.1774376168759-1e20f57" simplecloud-plugin-api = "0.0.1-platform.1766000824440-e57ed95" velocity = "3.5.0-SNAPSHOT" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index dbc3ce4..c61a118 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 3832b4c44ae4359cd68aaa4ffaa82346b369f894 Mon Sep 17 00:00:00 2001 From: xXJanisXx Date: Fri, 27 Mar 2026 15:18:25 +0100 Subject: [PATCH 2/5] feat: add subdomain routing --- .../shared/config/ConnectionConfig.kt | 13 ++++++++++++ .../PlayerChooseInitialServerListener.kt | 21 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConnectionConfig.kt b/connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConnectionConfig.kt index 6092424..47abfae 100644 --- a/connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConnectionConfig.kt +++ b/connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConnectionConfig.kt @@ -10,6 +10,7 @@ import org.spongepowered.configurate.objectmapping.ConfigSerializable data class ConnectionConfig( val version: Char = ConfigVersion.VERSION, val registration: RegistrationConfig = RegistrationConfig(), + val subdomain: SubdomainConfig = SubdomainConfig(), val connections: List = DefaultConfigs.CONNECTIONS, val networkJoinTargets: NetworkJoinTargetsConfig = DefaultConfigs.NETWORK_JOIN_TARGETS, val fallback: FallbackConfig = DefaultConfigs.FALLBACK, @@ -31,6 +32,18 @@ data class RegistrationServer( val port: Long = 0L ) +@ConfigSerializable +data class SubdomainConfig( + val enabled: Boolean = true, + val mappings: List = listOf() +) + +@ConfigSerializable +data class SubdomainMapping( + val subdomain: String = "", + val targetConnection: String = "" +) + @ConfigSerializable data class ConnectionEntry( val name: String = "", diff --git a/connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/listener/PlayerChooseInitialServerListener.kt b/connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/listener/PlayerChooseInitialServerListener.kt index 8f5b188..fde0e1c 100644 --- a/connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/listener/PlayerChooseInitialServerListener.kt +++ b/connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/listener/PlayerChooseInitialServerListener.kt @@ -16,6 +16,27 @@ class PlayerChooseInitialServerListener( val config = plugin.connectionPlugin.connectionConfig.get() val messages = plugin.connectionPlugin.messageConfig.get() + if (config.subdomain.enabled) { + val virtualHost = event.player.virtualHost.map { it.hostName }.orElse(null) + if (virtualHost != null) { + val mapping = config.subdomain.mappings.find { it.subdomain == virtualHost } + if (mapping != null) { + val connection = ConnectionResolver.findConnection(mapping.targetConnection, config.connections) + if (connection != null) { + val serverNames = proxy.allServers.map { it.serverInfo.name } + val matchingNames = ConnectionResolver.findMatchingServerNames(connection, serverNames) + val server = matchingNames + .mapNotNull { proxy.getServer(it).orElse(null) } + .minByOrNull { it.playersConnected.size } + if (server != null) { + event.setInitialServer(server) + return + } + } + } + } + } + if (!config.networkJoinTargets.enabled) return val serverNames = proxy.allServers.map { it.serverInfo.name } From b9e392a68392e073c6f7d742be065ff40b2ab6b0 Mon Sep 17 00:00:00 2001 From: xXJanisXx Date: Fri, 27 Mar 2026 15:40:49 +0100 Subject: [PATCH 3/5] refactor: rename subdomain mappings to routes --- .../plugin/connection/shared/config/ConnectionConfig.kt | 4 ++-- .../velocity/listener/PlayerChooseInitialServerListener.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConnectionConfig.kt b/connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConnectionConfig.kt index 47abfae..bfcb0c4 100644 --- a/connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConnectionConfig.kt +++ b/connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConnectionConfig.kt @@ -35,11 +35,11 @@ data class RegistrationServer( @ConfigSerializable data class SubdomainConfig( val enabled: Boolean = true, - val mappings: List = listOf() + val routes: List = listOf() ) @ConfigSerializable -data class SubdomainMapping( +data class SubdomainRoute( val subdomain: String = "", val targetConnection: String = "" ) diff --git a/connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/listener/PlayerChooseInitialServerListener.kt b/connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/listener/PlayerChooseInitialServerListener.kt index fde0e1c..196a8ad 100644 --- a/connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/listener/PlayerChooseInitialServerListener.kt +++ b/connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/listener/PlayerChooseInitialServerListener.kt @@ -19,7 +19,7 @@ class PlayerChooseInitialServerListener( if (config.subdomain.enabled) { val virtualHost = event.player.virtualHost.map { it.hostName }.orElse(null) if (virtualHost != null) { - val mapping = config.subdomain.mappings.find { it.subdomain == virtualHost } + val mapping = config.subdomain.routes.find { it.subdomain == virtualHost } if (mapping != null) { val connection = ConnectionResolver.findConnection(mapping.targetConnection, config.connections) if (connection != null) { From b7710393b5be6464ffeeaec0bd38bd30032ca1d1 Mon Sep 17 00:00:00 2001 From: xXJanisXx Date: Fri, 27 Mar 2026 15:59:52 +0100 Subject: [PATCH 4/5] feat: add subdomain routing support for bungeecord and waterdogpe --- .../listener/ServerConnectListener.kt | 21 +++++++++++++++++++ .../waterdog/handler/WaterdogJoinHandler.kt | 16 ++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/connection-bungeecord/src/main/kotlin/app/simplecloud/plugin/connection/bungeecord/listener/ServerConnectListener.kt b/connection-bungeecord/src/main/kotlin/app/simplecloud/plugin/connection/bungeecord/listener/ServerConnectListener.kt index 7fe10ff..7ff89bb 100644 --- a/connection-bungeecord/src/main/kotlin/app/simplecloud/plugin/connection/bungeecord/listener/ServerConnectListener.kt +++ b/connection-bungeecord/src/main/kotlin/app/simplecloud/plugin/connection/bungeecord/listener/ServerConnectListener.kt @@ -19,6 +19,27 @@ class ServerConnectListener( val config = plugin.connectionPlugin.connectionConfig.get() val messages = plugin.connectionPlugin.messageConfig.get() + if (config.subdomain.enabled) { + val virtualHost = event.player.pendingConnection.virtualHost?.hostName + if (virtualHost != null) { + val route = config.subdomain.routes.find { it.subdomain == virtualHost } + if (route != null) { + val connection = ConnectionResolver.findConnection(route.targetConnection, config.connections) + if (connection != null) { + val serverNames = plugin.proxy.servers.keys.toList() + val matchingNames = ConnectionResolver.findMatchingServerNames(connection, serverNames) + val targetServer = matchingNames + .mapNotNull { plugin.proxy.servers[it] } + .minByOrNull { it.players.size } + if (targetServer != null) { + event.target = targetServer + return + } + } + } + } + } + if (!config.networkJoinTargets.enabled) return val serverNames = plugin.proxy.servers.keys.toList() diff --git a/connection-waterdog/src/main/kotlin/app/simplecloud/plugin/connection/waterdog/handler/WaterdogJoinHandler.kt b/connection-waterdog/src/main/kotlin/app/simplecloud/plugin/connection/waterdog/handler/WaterdogJoinHandler.kt index 206f78b..4611758 100644 --- a/connection-waterdog/src/main/kotlin/app/simplecloud/plugin/connection/waterdog/handler/WaterdogJoinHandler.kt +++ b/connection-waterdog/src/main/kotlin/app/simplecloud/plugin/connection/waterdog/handler/WaterdogJoinHandler.kt @@ -13,6 +13,22 @@ class WaterdogJoinHandler( override fun determineServer(player: ProxiedPlayer): ServerInfo? { val config = plugin.connectionPlugin.connectionConfig.get() + if (config.subdomain.enabled) { + val virtualHost = player.loginData.joinHostname + val route = config.subdomain.routes.find { it.subdomain == virtualHost } + if (route != null) { + val connection = ConnectionResolver.findConnection(route.targetConnection, config.connections) + if (connection != null) { + val serverNames = plugin.proxy.servers.map { it.serverName } + val matchingNames = ConnectionResolver.findMatchingServerNames(connection, serverNames) + val serverInfo = matchingNames + .mapNotNull { name -> plugin.proxy.getServerInfo(name) } + .minByOrNull { it.players.size } + if (serverInfo != null) return serverInfo + } + } + } + if (!config.networkJoinTargets.enabled) return null val serverNames = plugin.proxy.servers.map { it.serverName } From 9da87ffba1f7f623677f9035026b210e56c86519 Mon Sep 17 00:00:00 2001 From: xXJanisXx Date: Thu, 2 Apr 2026 00:23:48 +0200 Subject: [PATCH 5/5] refactor: rename subdomain to address and remove enabled option from address config --- .../listener/ServerConnectListener.kt | 30 +++++++++---------- .../shared/config/ConnectionConfig.kt | 5 ++-- .../PlayerChooseInitialServerListener.kt | 30 +++++++++---------- .../waterdog/handler/WaterdogJoinHandler.kt | 24 +++++++-------- 4 files changed, 41 insertions(+), 48 deletions(-) diff --git a/connection-bungeecord/src/main/kotlin/app/simplecloud/plugin/connection/bungeecord/listener/ServerConnectListener.kt b/connection-bungeecord/src/main/kotlin/app/simplecloud/plugin/connection/bungeecord/listener/ServerConnectListener.kt index 7ff89bb..f81acf5 100644 --- a/connection-bungeecord/src/main/kotlin/app/simplecloud/plugin/connection/bungeecord/listener/ServerConnectListener.kt +++ b/connection-bungeecord/src/main/kotlin/app/simplecloud/plugin/connection/bungeecord/listener/ServerConnectListener.kt @@ -19,22 +19,20 @@ class ServerConnectListener( val config = plugin.connectionPlugin.connectionConfig.get() val messages = plugin.connectionPlugin.messageConfig.get() - if (config.subdomain.enabled) { - val virtualHost = event.player.pendingConnection.virtualHost?.hostName - if (virtualHost != null) { - val route = config.subdomain.routes.find { it.subdomain == virtualHost } - if (route != null) { - val connection = ConnectionResolver.findConnection(route.targetConnection, config.connections) - if (connection != null) { - val serverNames = plugin.proxy.servers.keys.toList() - val matchingNames = ConnectionResolver.findMatchingServerNames(connection, serverNames) - val targetServer = matchingNames - .mapNotNull { plugin.proxy.servers[it] } - .minByOrNull { it.players.size } - if (targetServer != null) { - event.target = targetServer - return - } + val virtualHost = event.player.pendingConnection.virtualHost?.hostName + if (virtualHost != null) { + val route = config.address.routes.find { it.subdomain == virtualHost } + if (route != null) { + val connection = ConnectionResolver.findConnection(route.targetConnection, config.connections) + if (connection != null) { + val serverNames = plugin.proxy.servers.keys.toList() + val matchingNames = ConnectionResolver.findMatchingServerNames(connection, serverNames) + val targetServer = matchingNames + .mapNotNull { plugin.proxy.servers[it] } + .minByOrNull { it.players.size } + if (targetServer != null) { + event.target = targetServer + return } } } diff --git a/connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConnectionConfig.kt b/connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConnectionConfig.kt index bfcb0c4..4ecf56d 100644 --- a/connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConnectionConfig.kt +++ b/connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConnectionConfig.kt @@ -10,7 +10,7 @@ import org.spongepowered.configurate.objectmapping.ConfigSerializable data class ConnectionConfig( val version: Char = ConfigVersion.VERSION, val registration: RegistrationConfig = RegistrationConfig(), - val subdomain: SubdomainConfig = SubdomainConfig(), + val address: AddressConfig = AddressConfig(), val connections: List = DefaultConfigs.CONNECTIONS, val networkJoinTargets: NetworkJoinTargetsConfig = DefaultConfigs.NETWORK_JOIN_TARGETS, val fallback: FallbackConfig = DefaultConfigs.FALLBACK, @@ -33,8 +33,7 @@ data class RegistrationServer( ) @ConfigSerializable -data class SubdomainConfig( - val enabled: Boolean = true, +data class AddressConfig( val routes: List = listOf() ) diff --git a/connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/listener/PlayerChooseInitialServerListener.kt b/connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/listener/PlayerChooseInitialServerListener.kt index 196a8ad..3133aea 100644 --- a/connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/listener/PlayerChooseInitialServerListener.kt +++ b/connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/listener/PlayerChooseInitialServerListener.kt @@ -16,22 +16,20 @@ class PlayerChooseInitialServerListener( val config = plugin.connectionPlugin.connectionConfig.get() val messages = plugin.connectionPlugin.messageConfig.get() - if (config.subdomain.enabled) { - val virtualHost = event.player.virtualHost.map { it.hostName }.orElse(null) - if (virtualHost != null) { - val mapping = config.subdomain.routes.find { it.subdomain == virtualHost } - if (mapping != null) { - val connection = ConnectionResolver.findConnection(mapping.targetConnection, config.connections) - if (connection != null) { - val serverNames = proxy.allServers.map { it.serverInfo.name } - val matchingNames = ConnectionResolver.findMatchingServerNames(connection, serverNames) - val server = matchingNames - .mapNotNull { proxy.getServer(it).orElse(null) } - .minByOrNull { it.playersConnected.size } - if (server != null) { - event.setInitialServer(server) - return - } + val virtualHost = event.player.virtualHost.map { it.hostName }.orElse(null) + if (virtualHost != null) { + val route = config.address.routes.find { it.subdomain == virtualHost } + if (route != null) { + val connection = ConnectionResolver.findConnection(route.targetConnection, config.connections) + if (connection != null) { + val serverNames = proxy.allServers.map { it.serverInfo.name } + val matchingNames = ConnectionResolver.findMatchingServerNames(connection, serverNames) + val server = matchingNames + .mapNotNull { proxy.getServer(it).orElse(null) } + .minByOrNull { it.playersConnected.size } + if (server != null) { + event.setInitialServer(server) + return } } } diff --git a/connection-waterdog/src/main/kotlin/app/simplecloud/plugin/connection/waterdog/handler/WaterdogJoinHandler.kt b/connection-waterdog/src/main/kotlin/app/simplecloud/plugin/connection/waterdog/handler/WaterdogJoinHandler.kt index 4611758..fb20953 100644 --- a/connection-waterdog/src/main/kotlin/app/simplecloud/plugin/connection/waterdog/handler/WaterdogJoinHandler.kt +++ b/connection-waterdog/src/main/kotlin/app/simplecloud/plugin/connection/waterdog/handler/WaterdogJoinHandler.kt @@ -13,19 +13,17 @@ class WaterdogJoinHandler( override fun determineServer(player: ProxiedPlayer): ServerInfo? { val config = plugin.connectionPlugin.connectionConfig.get() - if (config.subdomain.enabled) { - val virtualHost = player.loginData.joinHostname - val route = config.subdomain.routes.find { it.subdomain == virtualHost } - if (route != null) { - val connection = ConnectionResolver.findConnection(route.targetConnection, config.connections) - if (connection != null) { - val serverNames = plugin.proxy.servers.map { it.serverName } - val matchingNames = ConnectionResolver.findMatchingServerNames(connection, serverNames) - val serverInfo = matchingNames - .mapNotNull { name -> plugin.proxy.getServerInfo(name) } - .minByOrNull { it.players.size } - if (serverInfo != null) return serverInfo - } + val virtualHost = player.loginData.joinHostname + val route = config.address.routes.find { it.subdomain == virtualHost } + if (route != null) { + val connection = ConnectionResolver.findConnection(route.targetConnection, config.connections) + if (connection != null) { + val serverNames = plugin.proxy.servers.map { it.serverName } + val matchingNames = ConnectionResolver.findMatchingServerNames(connection, serverNames) + val serverInfo = matchingNames + .mapNotNull { name -> plugin.proxy.getServerInfo(name) } + .minByOrNull { it.players.size } + if (serverInfo != null) return serverInfo } }