Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 3 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,39 +1,11 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
.idea/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### Kotlin ###
.kotlin/

### VS Code ###
.vscode/
Expand Down
10 changes: 0 additions & 10 deletions .idea/codeStyles/Project.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/codeStyles/codeStyleConfig.xml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [2024] [SimpleCloud]
Copyright [2024-2026] [SimpleCloud]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@

> All information about this project can be found in our detailed [documentation][docs-thisproject].

The Server Connection Plugin provides comprehensive player connection management for your network, including network join handling, fallback servers, and navigation commands.
The Server Connection Plugin provides comprehensive player connection management for your network. It automatically registers SimpleCloud v3 servers on your proxy.

## Features

- [x] **Velocity**
- [x] **BungeeCord**
- [x] **Waterdog PE**
- [ ] **Gate**
- [x] **Connection targets**: Connection targets define server groups that players can connect to
- [x] **Matcher Operations**: Match Server names by Operations
- [x] **Server registration**: Automatically registers SimpleCloud servers on your proxy
- [x] **Additional servers**: Add non network servers manually
- [x] **Connection targets**: Define server groups and persistent servers that players can connect to
- [x] **Fallback servers**: Automatically redirect players when a server becomes unavailable
- [x] **Matcher Operations**: Match server names by operations

## Contributing

Expand All @@ -50,11 +54,11 @@ This repository is licensed under [Apache 2.0][license].

[banner]: https://github.com/simplecloudapp/branding/blob/main/readme/banner/plugin/server-connection.png?raw=true

[issue-bug-report]: https://github.com/theSimpleCloud/server-connection-plugin/issues/new?labels=bug&projects=template=01_BUG-REPORT.yml&title=%5BBUG%5D+%3Ctitle%3E
[issue-bug-report]: https://github.com/simplecloudapp/server-connection-plugin/issues/new?labels=bug&projects=template=01_BUG-REPORT.yml&title=%5BBUG%5D+%3Ctitle%3E

[issue-feature-request]: https://github.com/theSimpleCloud/server-connection-plugin/discussions/new?category=ideas
[issue-feature-request]: https://github.com/simplecloudapp/server-connection-plugin/discussions/new?category=ideas

[docs-thisproject]: https://docs.simplecloud.app/plugin/server-connection
[docs-thisproject]: https://docs.simplecloud.app/en/manual/plugin/server-connection

[docs-contribute]: https://docs.simplecloud.app/contribute

Expand Down Expand Up @@ -84,4 +88,4 @@ This repository is licensed under [Apache 2.0][license].

[badge-bluesky]: https://img.shields.io/badge/Follow_@simplecloud.app-d95652.svg?style=flat-square&logo=bluesky&color=27272a

[badge-youtube]: https://img.shields.io/badge/youtube-d95652.svg?style=flat-square&logo=youtube&color=27272a
[badge-youtube]: https://img.shields.io/badge/youtube-d95652.svg?style=flat-square&logo=youtube&color=27272a
40 changes: 17 additions & 23 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.shadow)
alias(libs.plugins.sonatype.central.portal.publisher)
`maven-publish`
id("maven-publish")
}

val baseVersion = "0.0.1"
val commitHash = System.getenv("COMMIT_HASH")
val snapshotversion = "${baseVersion}-dev.$commitHash"
val snapshotversion = "${baseVersion}-platform.$commitHash"

allprojects {
group = "app.simplecloud.plugin"
Expand All @@ -18,29 +19,33 @@ allprojects {
repositories {
mavenCentral()
maven("https://buf.build/gen/maven")
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://libraries.minecraft.net")
maven("https://repo.papermc.io/repository/maven-public")
maven("https://repo.simplecloud.app/snapshots")
maven("https://repo.waterdog.dev/releases/")
maven("https://repo.waterdog.dev/snapshots/")
maven("https://repo.opencollab.dev/maven-releases/")
maven("https://repo.opencollab.dev/maven-snapshots/")
}
}

subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "com.gradleup.shadow")
apply(plugin = "net.thebugmc.gradle.sonatype-central-portal-publisher")
apply(plugin = "maven-publish")

dependencies {
testImplementation(rootProject.libs.kotlin.test)
compileOnly(rootProject.libs.kotlin.jvm)
implementation(rootProject.libs.kotlin.jvm)
implementation(rootProject.libs.kotlin.coroutines.core)
implementation(rootProject.libs.log4j.api)
}

kotlin {
jvmToolchain(21)
compilerOptions {
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21)
apiVersion.set(KotlinVersion.KOTLIN_2_0)
jvmTarget.set(JvmTarget.JVM_21)
freeCompilerArgs.add("-Xannotation-default-target=param-property")
}
}

Expand Down Expand Up @@ -72,23 +77,12 @@ subprojects {
}
}

signing {
if (commitHash != null) {
return@signing
}

sign(publishing.publications)
useGpgCmd()
}

tasks.named("shadowJar", ShadowJar::class) {
mergeServiceFiles()
relocate("org.spongepowered", "app.simplecloud.plugin.relocate.spongepowered")
relocate("app.simplecloud.plugin.api", "app.simplecloud.plugin.relocate.plugin.api")
archiveFileName.set("${project.name}.jar")

val externalRelocatePath = "app.simplecloud.external"
relocate("kotlinx", "${externalRelocatePath}.kotlinx")
relocate("io", "${externalRelocatePath}.io")
relocate("org", "${externalRelocatePath}.org")
archiveClassifier.set("")
}

tasks.test {
Expand Down
17 changes: 6 additions & 11 deletions connection-bungeecord/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ plugins {
}

dependencies {
api(project(":connection-shared"))
api("net.kyori:adventure-text-minimessage:4.16.0")
api("net.kyori:adventure-platform-bungeecord:4.3.2")
compileOnly("net.md-5:bungeecord-api:1.20-R0.2")
implementation(project(":connection-shared"))
implementation(libs.adventure.platform.bungeecord)
implementation(libs.bundles.adventure)
compileOnly(libs.simplecloud.api)
compileOnly(libs.bungeecord.api)
}

modrinth {
Expand All @@ -16,9 +17,6 @@ modrinth {
versionType.set("beta")
uploadFile.set(tasks.shadowJar)
gameVersions.addAll(



"1.20",
"1.20.1",
"1.20.2",
Expand All @@ -38,10 +36,7 @@ modrinth {
"1.21.9",
"1.21.10",
"1.21.11",



)
)
loaders.add("bungeecord")
loaders.add("waterfall")
changelog.set("https://docs.simplecloud.app/changelog")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package app.simplecloud.plugin.connection.bungeecord

import app.simplecloud.api.CloudApi
import app.simplecloud.plugin.connection.bungeecord.command.BungeeCordCommandManager
import app.simplecloud.plugin.connection.bungeecord.command.ConnectionCommand
import app.simplecloud.plugin.connection.bungeecord.listener.ServerConnectListener
import app.simplecloud.plugin.connection.bungeecord.listener.ServerKickListener
import app.simplecloud.plugin.connection.bungeecord.registration.BungeeCordServerRegistry
import app.simplecloud.plugin.connection.shared.ConnectionPlugin
import kotlinx.coroutines.*
import net.kyori.adventure.platform.bungeecord.BungeeAudiences
import net.md_5.bungee.api.plugin.Plugin
import org.apache.logging.log4j.LogManager
import java.net.InetSocketAddress

class BungeeCordConnectionPlugin : Plugin() {

private val api = CloudApi.create()
private val logger = LogManager.getLogger(BungeeCordConnectionPlugin::class.java)
private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
private val audiences = BungeeAudiences.create(this)
private val commandManager = BungeeCordCommandManager(this, audiences)

val connectionPlugin = ConnectionPlugin(
dataFolder.toString(),
api,
BungeeCordServerRegistry(this, proxy)
)

override fun onEnable() {
cleanupServers()
registerAdditionalServers()
registerListeners()
registerCommands()

scope.launch {
connectionPlugin.start()
}
}

override fun onDisable() {
commandManager.unregisterCommands()
audiences.close()
scope.launch { connectionPlugin.shutdown() }
scope.cancel()
}

private fun cleanupServers() {
if (connectionPlugin.connectionConfig.get().registration.enabled) {
proxy.servers.clear()
proxy.configurationAdapter.servers.clear()
proxy.configurationAdapter.listeners.forEach {
it.serverPriority.clear()
}
}
}

private fun registerAdditionalServers() {
if (connectionPlugin.connectionConfig.get().registration.enabled) {
val additionalServers = connectionPlugin.connectionConfig.get().registration.additionalServers
additionalServers.forEach {
val info = proxy.constructServerInfo(
it.name,
InetSocketAddress.createUnresolved(it.address, it.port.toInt()),
it.name,
false
)
proxy.servers[it.name] = info
logger.info("Additional server ${info.name} has been registered!")
}
}
}

private fun registerListeners() {
proxy.pluginManager.registerListener(this, ServerConnectListener(this, audiences))
proxy.pluginManager.registerListener(this, ServerKickListener(this, audiences))
}

private fun registerCommands() {
commandManager.registerCommands()
proxy.pluginManager.registerCommand(this, ConnectionCommand(this, audiences))
}

}
Loading