Skip to content

Commit 6e1e785

Browse files
committed
complete rebrand, compiling, untested
1 parent d5df908 commit 6e1e785

705 files changed

Lines changed: 60855 additions & 9990 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,38 @@
1616
./gradlew publishToMavenLocal
1717
```
1818

19-
CI uses **Java 25 GraalVM**. The Java toolchain version is set in `gradle.properties` (`javaVersion=25`).
19+
CI uses **Java 25 GraalVM**. The Java toolchain version is set in `gradle.properties` (
20+
`javaVersion=25`).
2021

2122
## Architecture
2223

23-
**Multi-platform Minecraft server API** — Kotlin on JVM, targeting Paper/Bukkit, Velocity, and Standalone (Hytale is future/placeholder). Every platform follows an **API/Implementation split**:
24+
**Multi-platform Minecraft server API** — Kotlin on JVM, targeting Paper/Bukkit, Velocity, and
25+
Standalone (Hytale is future/placeholder). Every platform follows an **API/Implementation split**:
2426

2527
- `-api` modules define public interfaces and extension functions (what consumers depend on)
2628
- `-server` modules contain implementations (shaded into the final JAR, not published as API)
2729
- `surf-api-shared` contains cross-platform annotations, the component system, and internal hooks
28-
- `surf-api-gradle-plugin` provides Gradle plugins (`dev.slne.surf.surfapi.gradle.paper-plugin`, etc.) that downstream projects apply, and contains the KSP symbol processor (`surf-api-processor`)
30+
- `surf-api-gradle-plugin` provides Gradle plugins (`dev.slne.surf.api.gradle.paper-plugin`, etc.)
31+
that downstream projects apply, and contains the KSP symbol processor (`surf-api-processor`)
2932

3033
### Service Discovery (two mechanisms)
3134

32-
1. **`requiredService<T>()`** — For singleton bridges/APIs. Uses Adventure's `Services.serviceWithFallback()` backed by Java `ServiceLoader`. Implementations register with `@AutoService(InterfaceName::class)`. Used for NMS bridges, platform API singletons, and core services.
35+
1. **`requiredService<T>()`** — For singleton bridges/APIs. Uses Adventure's
36+
`Services.serviceWithFallback()` backed by Java `ServiceLoader`. Implementations register with
37+
`@AutoService(InterfaceName::class)`. Used for NMS bridges, platform API singletons, and core
38+
services.
3339

34-
2. **Component System** — For lifecycle-managed components. Classes annotated with `@ComponentMeta` (or meta-annotations `@Service`, `@Repository`) are discovered at compile-time by KSP, which writes JSON metadata to `META-INF/surfapi/components/`. At runtime, `ComponentService` loads, topologically sorts by `@Priority` and `@DependsOnComponent`, checks conditions (`@ConditionalOnProperty`, `@DependsOnPlugin`, `@DependsOnClass`, etc.), then calls `suspend fun load()``enable()``disable()`.
40+
2. **Component System** — For lifecycle-managed components. Classes annotated with
41+
`@ComponentMeta` (or meta-annotations `@Service`, `@Repository`) are discovered at compile-time
42+
by KSP, which writes JSON metadata to `META-INF/surfapi/components/`. At runtime,
43+
`ComponentService` loads, topologically sorts by `@Priority` and `@DependsOnComponent`, checks
44+
conditions (`@ConditionalOnProperty`, `@DependsOnPlugin`, `@DependsOnClass`, etc.), then calls
45+
`suspend fun load()``enable()``disable()`.
3546

3647
### NMS Bridge Pattern
3748

38-
Platform-specific (NMS) code is abstracted behind bridge interfaces in `-api` with implementations in `-server`:
49+
Platform-specific (NMS) code is abstracted behind bridge interfaces in `-api` with implementations
50+
in `-server`:
3951

4052
```kotlin
4153
// In -api: interface + companion delegation
@@ -56,15 +68,20 @@ Bridge implementations call `checkInstantiationByServiceLoader()` in their `init
5668

5769
### Kotlin Features
5870

59-
- **Context parameters** enabled globally (`-Xcontext-parameters`). Used extensively in inventory framework DSLs:
71+
- **Context parameters** enabled globally (`-Xcontext-parameters`). Used extensively in inventory
72+
framework DSLs:
6073
```kotlin
6174
context(ctx: AbstractSurfViewContext<ViewRef>)
6275
fun <ViewRef : AbstractSurfViewRef> onOpen(block: context(ViewRef) OpenContext.() -> Unit)
6376
```
64-
- **`@InternalSurfApi`**`@RequiresOptIn` annotation for internal APIs. All subprojects opt in via compiler args. Mark new internal APIs with this.
65-
- **Coroutines** for all async work. Component lifecycle methods are `suspend`. Bukkit uses MCCoroutine (Folia-aware) for dispatching.
66-
- **Extension functions** are the primary API enrichment pattern, organized in files named `*-extension.kt` or `*-extensions.kt`.
67-
- **DSL markers** (`@InventoryFrameworkDSL`, `@ItemDsl`, `@PaneMarker`) restrict scope in builder DSLs.
77+
- **`@InternalSurfApi`**`@RequiresOptIn` annotation for internal APIs. All subprojects opt in via
78+
compiler args. Mark new internal APIs with this.
79+
- **Coroutines** for all async work. Component lifecycle methods are `suspend`. Bukkit uses
80+
MCCoroutine (Folia-aware) for dispatching.
81+
- **Extension functions** are the primary API enrichment pattern, organized in files named
82+
`*-extension.kt` or `*-extensions.kt`.
83+
- **DSL markers** (`@InventoryFrameworkDSL`, `@ItemDsl`, `@PaneMarker`) restrict scope in builder
84+
DSLs.
6885

6986
### Logging
7087

@@ -78,33 +95,41 @@ log.atWarning().withCause(e).log("Failed to do X for %s", name)
7895
### Package Structure
7996

8097
```
81-
dev.slne.surf.surfapi # root
82-
dev.slne.surf.surfapi.core.api # core API interfaces
83-
dev.slne.surf.surfapi.core.server # core implementations
84-
dev.slne.surf.surfapi.bukkit.api # bukkit API (extensions, bridges, DSLs)
85-
dev.slne.surf.surfapi.bukkit.server # bukkit implementations
86-
dev.slne.surf.surfapi.velocity.api / .server # velocity
87-
dev.slne.surf.surfapi.shared.api # shared annotations and component system
88-
dev.slne.surf.surfapi.libs.* # relocation target for shaded deps
98+
dev.slne.surf.api # root
99+
dev.slne.surf.api.core.api # core API interfaces
100+
dev.slne.surf.api.core.server # core implementations
101+
dev.slne.surf.api.paper.api # bukkit API (extensions, bridges, DSLs)
102+
dev.slne.surf.api.paper.server # bukkit implementations
103+
dev.slne.surf.api.velocity.api / .server # velocity
104+
dev.slne.surf.api.shared.api # shared annotations and component system
105+
dev.slne.surf.api.libs.* # relocation target for shaded deps
89106
```
90107

91108
### Dependency Shading
92109

93-
All non-platform dependencies are shaded via Shadow and relocated to `dev.slne.surf.surfapi.libs.*` (configured in `gradle.properties` as `relocationPrefix`). Platform APIs (Paper, Velocity) are `compileOnly`. Relocations are configured in the Gradle plugin's `CommonSurfPlugin` using an infix DSL:
110+
All non-platform dependencies are shaded via Shadow and relocated to `dev.slne.surf.api.libs.*` (
111+
configured in `gradle.properties` as `relocationPrefix`). Platform APIs (Paper, Velocity) are
112+
`compileOnly`. Relocations are configured in the Gradle plugin's `CommonSurfPlugin` using an infix
113+
DSL:
94114

95115
```kotlin
96116
"me.devnatan.inventoryframework" relocatesTo "devnatan.inventoryframework"
97117
```
98118

99119
### Versioning
100120

101-
Format: `{MC_VERSION}-{LIBRARY_VERSION}` (e.g., `1.21.11-2.62.0`), set in `gradle.properties`. Publishing triggers on pushes to `version/*` branches.
121+
Format: `{MC_VERSION}-{LIBRARY_VERSION}` (e.g., `1.21.11-2.62.0`), set in `gradle.properties`.
122+
Publishing triggers on pushes to `version/*` branches.
102123

103124
## When Making Changes
104125

105-
- **API changes** go in `-api` modules; implementations in `-server` modules. Never expose `-server` types in public API.
106-
- **New components**: annotate with `@ComponentMeta` (or `@Service`/`@Repository`), implement `Component`, and declare dependencies with `@DependsOnComponent`, `@DependsOnPlugin`, etc.
107-
- **New bridges**: define interface in `-api` with companion delegation via `requiredService()`, implement in `-server` with `@AutoService`.
108-
- **New extension functions**: place in a file named `{topic}-extensions.kt` in the appropriate `-api` module.
126+
- **API changes** go in `-api` modules; implementations in `-server` modules. Never expose `-server`
127+
types in public API.
128+
- **New components**: annotate with `@ComponentMeta` (or `@Service`/`@Repository`), implement
129+
`Component`, and declare dependencies with `@DependsOnComponent`, `@DependsOnPlugin`, etc.
130+
- **New bridges**: define interface in `-api` with companion delegation via `requiredService()`,
131+
implement in `-server` with `@AutoService`.
132+
- **New extension functions**: place in a file named `{topic}-extensions.kt` in the appropriate
133+
`-api` module.
109134
- **KDoc**: required for all public API members.
110135
- **Version catalog**: all dependency versions live in `gradle/libs.versions.toml`.

.github/workflows/build-pr-jar.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [ opened, synchronize, reopened, labeled ]
66

77
env:
8-
MODULE_REGEX: "surf-api-bukkit-server.*-all\\.jar$|surf-api-velocity-server.*-all\\.jar$|surf-api-standalone-server.*-all\\.jar$|surf-api-hytale-server.*-all\\.jar$"
8+
MODULE_REGEX: "surf-api-paper-server.*-all\\.jar$|surf-api-velocity-server.*-all\\.jar$|surf-api-standalone-server.*-all\\.jar$"
99

1010
jobs:
1111
build_pr:

.github/workflows/publish-docs.yml

Lines changed: 0 additions & 94 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111
SLNE_SNAPSHOTS_REPO_PASSWORD: ${{ secrets.SLNE_SNAPSHOTS_REPO_PASSWORD }}
1212
SLNE_RELEASES_REPO_USERNAME: ${{ secrets.SLNE_RELEASES_REPO_USERNAME }}
1313
SLNE_RELEASES_REPO_PASSWORD: ${{ secrets.SLNE_RELEASES_REPO_PASSWORD }}
14-
MODULE_REGEX: "surf-api-bukkit-server.*-all\\.jar$|surf-api-velocity-server.*-all\\.jar$|surf-api-standalone-server.*-all\\.jar$|surf-api-hytale-server.*-all\\.jar$"
14+
MODULE_REGEX: "surf-api-paper-server.*-all\\.jar$|surf-api-velocity-server.*-all\\.jar$|surf-api-standalone-server.*-all\\.jar$"
1515
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
1616

1717
jobs:

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ subprojects {
2424
afterEvaluate {
2525
extensions.findByType<KotlinJvmExtension>()?.apply {
2626
compilerOptions {
27-
optIn.add("dev.slne.surf.surfapi.shared.api.util.InternalSurfApi")
27+
optIn.add("dev.slne.surf.api.shared.api.util.InternalSurfApi")
2828
freeCompilerArgs.add("-Xcontext-parameters")
2929
}
3030
}

buildSrc/src/main/kotlin/core-convention.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ extensions.configure<KotlinJvmProjectExtension> {
5050
java {
5151
withSourcesJar()
5252

53-
if (project.name != "surf-api-bukkit-plugin-test") {
53+
if (project.name != "surf-api-paper-plugin-test") {
5454
withJavadocJar()
5555
}
5656
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
77
javaVersion=25
88
mcVersion=26.1
99
group=dev.slne.surf
10-
version=26.1-2.77.0
11-
relocationPrefix=dev.slne.surf.surfapi.libs
10+
version=26.1-3.0.0
11+
relocationPrefix=dev.slne.surf.api.libs
1212
snapshot=false

settings.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
1313

1414
rootProject.name = "surf-api"
1515

16-
include(":surf-api-core:surf-api-core-api")
16+
include(":surf-api-core:surf-api-core")
1717
include(":surf-api-core:surf-api-core-server")
1818

19-
include(":surf-api-bukkit:surf-api-bukkit-api")
20-
include(":surf-api-bukkit:surf-api-bukkit-server")
19+
include(":surf-api-paper:surf-api-paper")
20+
include(":surf-api-paper:surf-api-paper-server")
2121

22-
include(":surf-api-velocity:surf-api-velocity-api")
22+
include(":surf-api-velocity:surf-api-velocity")
2323
include(":surf-api-velocity:surf-api-velocity-server")
2424

2525
include("surf-api-standalone")
@@ -33,6 +33,6 @@ include("surf-api-shared:surf-api-shared-internal")
3333
val ci = System.getenv("CI")?.toBoolean() ?: false
3434

3535
if (!ci) {
36-
// include(":surf-api-bukkit:surf-api-bukkit-plugin-test")
36+
// include(":surf-api-paper:surf-api-paper-plugin-test")
3737
include("surf-api-generator")
3838
}

0 commit comments

Comments
 (0)