Skip to content

feat: configure join states for external servers - #25

Merged
FllipEis merged 2 commits into
simplecloudapp:feat/external-server-joinstatesfrom
TheoNX:feature/external-server-joinstates
Oct 9, 2026
Merged

FllipEis merged 2 commits into
simplecloudapp:feat/external-server-joinstatesfrom
TheoNX:feature/external-server-joinstates

Conversation

@TheoNX

@TheoNX TheoNX commented Oct 9, 2026 •

Copy link
Copy Markdown

External servers such as a standalone limbo currently use initial-state because they have no SimpleCloud join state. With initial-state: maintenance, ordinary players cannot enter that limbo even while the proxy itself is public.

Add an optional external-server-joinstates map 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 /joinstate continues to apply. External servers without a matching entry still use initial-state; the proxy's own admission checks continue to apply.

For example, with the proxy's current join state set to public:

initial-state: maintenance
external-server-joinstates:
  queue-limbo: public

Both Velocity and BungeeCord include the setting next to joinstates, with a short comment. OldConfigMigrator adds 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 to initial-state.

Validation: ./gradlew build shadowJar completed successfully on Java 21, including all 28 existing tests. git diff --check passed. No new tests were added.

@FllipEis FllipEis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename it to externalServerJoinStates / external-server-joinstates and put it next to joinstates.

Comment on lines +30 to +38
# 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

@FllipEis FllipEis Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as velocity.

@TheoNX TheoNX changed the title feat: allow per-server join state overrides feat: configure join states for external servers Oct 9, 2026
@TheoNX
TheoNX requested a review from FllipEis October 9, 2026 20:39
@FllipEis
FllipEis changed the base branch from main to feat/external-server-joinstates October 9, 2026 21:33
@FllipEis
FllipEis merged commit 9dec8e0 into simplecloudapp:feat/external-server-joinstates Oct 9, 2026
@FllipEis

FllipEis commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR! I merged it into feat/external-server-joinstates. There are still a couple of things I'd like to change, but I'll just do them myself before it goes into main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants