Skip to content

Commit 3684fbc

Browse files
feat: add server category support to SurfCoreApi and its implementations
- Extend `SurfCoreApi` with `getCurrentServerCategory` method. - Update all implementations (`Paper` and `Velocity`) to include server category retrieval. - Modify `SurfServerConfig` to include a `serverCategory` field.
1 parent 635a17f commit 3684fbc

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

surf-core-api/surf-core-api-common/src/main/kotlin/dev/slne/surf/core/api/common/SurfCoreApi.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface SurfCoreApi {
1313
fun getPlayer(uuid: UUID): SurfPlayer?
1414

1515
fun getCurrentServerName(): String
16+
fun getCurrentServerCategory(): String
1617

1718
suspend fun getOfflinePlayer(name: String): SurfPlayer?
1819
suspend fun getOfflinePlayer(uuid: UUID): SurfPlayer?

surf-core-core/surf-core-core-common/src/main/kotlin/dev/slne/surf/core/core/common/config/SurfServerConfig.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ import org.spongepowered.configurate.objectmapping.ConfigSerializable
55
@ConfigSerializable
66
data class SurfServerConfig(
77
val serverName: String = "unknown",
8+
val serverCategory: String = "unknown"
89
)

surf-core-paper/src/main/kotlin/dev/slne/surf/core/paper/api/SurfCoreApiPaperImpl.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ import net.kyori.adventure.util.Services
99
@AutoService(SurfCoreApi::class)
1010
class SurfCoreApiPaperImpl : SurfCoreApiImpl(), Services.Fallback {
1111
override fun getCurrentServerName() = surfServerConfig.serverName
12+
override fun getCurrentServerCategory() = surfServerConfig.serverCategory
1213
}

surf-core-velocity/src/main/kotlin/dev/slne/surf/core/velocity/api/SurfCoreApiVelocityImpl.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ import net.kyori.adventure.util.Services
99
@AutoService(SurfCoreApi::class)
1010
class SurfCoreApiVelocityImpl : SurfCoreApiImpl(), Services.Fallback {
1111
override fun getCurrentServerName() = surfServerConfig.serverName
12+
override fun getCurrentServerCategory() = surfServerConfig.serverCategory
1213
}

0 commit comments

Comments
 (0)