Repository navigation
Conversation
FllipEis
left a comment
There was a problem hiding this comment.
Idea is fine, but it should only be the fallback for non-cloud servers. Please also add it to OldConfigMigrator, same as show-kick-reason:
// ensureMainConfigDefaults
if (node.node("external-server-joinstates").virtual()) {
node.node("external-server-joinstates").set(ProxyEssentialsConfig().externalServerJoinStates)
changed = true
}
// applyMainConfigComments
node("external-server-joinstates").comment(EXTERNAL_SERVER_JOINSTATES_COMMENT)
// decorateMainConfigYaml
.insertBefore("external-server-joinstates:", EXTERNAL_SERVER_JOINSTATES_YAML_COMMENT)
private const val EXTERNAL_SERVER_JOINSTATES_COMMENT =
"Join states for servers not managed by SimpleCloud, keyed by server name.\n" +
"Example: queue-limbo: public"
private const val EXTERNAL_SERVER_JOINSTATES_YAML_COMMENT =
"\n# Join states for servers not managed by SimpleCloud, keyed by server name.\n" +
"# Example: queue-limbo: public\n"| } | ||
|
|
||
| suspend fun getJoinStateForServer(serverName: String): String { | ||
| proxyPlugin.proxyEssentialsConfig.get().serverJoinstates[serverName]?.let { return it } |
There was a problem hiding this comment.
This also overrides cloud-managed servers, so /joinstate would silently do nothing for them. Please only use it as the fallback instead of initialState at the end. Also no ?.let { return it } here. Something like this:
val config = proxyPlugin.proxyEssentialsConfig.get()
val externalJoinState = config.externalServerJoinStates.entries
.firstOrNull { it.key.equals(serverName, ignoreCase = true) }
?.value
if (externalJoinState != null) {
return externalJoinState
}
return config.initialState| ) | ||
| ) | ||
| ), | ||
| @Setting("server-joinstates") val serverJoinstates: Map<String, String> = emptyMap() |
There was a problem hiding this comment.
Please rename it to externalServerJoinStates / external-server-joinstates and put it next to joinstates.
| # Optional join state overrides keyed by exact, case-sensitive proxy server names. | ||
| # Applies to external and SimpleCloud-managed servers before cloud state resolution. | ||
| # The proxy's own join state and network-wide admission checks still apply. | ||
| # Values must name a join state defined above; unknown values fall back to initial-state. | ||
| server-joinstates: {} | ||
| # Example: allow an external limbo when the proxy's current join state is public, | ||
| # even if initial-state (the fallback for unknown servers) is maintenance. | ||
| # server-joinstates: | ||
| # queue-limbo: public |
There was a problem hiding this comment.
Comment is too long. Please shorten it to one or two lines.
| # Optional join state overrides keyed by exact, case-sensitive proxy server names. | ||
| # Applies to external and SimpleCloud-managed servers before cloud state resolution. | ||
| # The proxy's own join state and network-wide admission checks still apply. | ||
| # Values must name a join state defined above; unknown values fall back to initial-state. |
There was a problem hiding this comment.
A typo here puts the server into initial-state. Please warn on load if the join state doesn't exist.
| full: 'simplecloud.proxy-essentials.join.maintenance' | ||
| forced-motd-layout: maintenance | ||
|
|
||
| # Optional join state overrides keyed by exact, case-sensitive proxy server names. |
|
Thanks for the PR! I merged it into |
External servers such as a standalone limbo currently use
initial-statebecause they have no SimpleCloud join state. Withinitial-state: maintenance, ordinary players cannot enter that limbo even while the proxy itself is public.Add an optional
external-server-joinstatesmap for servers not managed by SimpleCloud, matched by registered proxy server name without regard to case. Cloud-managed servers retain their service, group, and persistent-server join states, so/joinstatecontinues to apply. External servers without a matching entry still useinitial-state; the proxy's own admission checks continue to apply.For example, with the proxy's current join state set to public:
Both Velocity and BungeeCord include the setting next to
joinstates, with a short comment.OldConfigMigratoradds the empty default and comments to existing and legacy configurations. Unknown configured join states produce a warning on load and reload, and retain the existing fallback toinitial-state.Validation:
./gradlew build shadowJarcompleted successfully on Java 21, including all 28 existing tests.git diff --checkpassed. No new tests were added.