Skip to content

Commit 1d4887d

Browse files
feat: add thisServer method in ServerApi
1 parent baf5999 commit 1d4887d

File tree

1 file changed

+14
-0
lines changed
  • controller-api/src/main/kotlin/app/simplecloud/controller/api

1 file changed

+14
-0
lines changed

controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ interface ServerApi {
1717
*/
1818
fun getAllServers(): CompletableFuture<List<Server>>
1919

20+
/**
21+
* @return a [CompletableFuture] with the [Server] from the SIMPLECLOUD_UNIQUE_ID environment
22+
*/
23+
fun thisServer(): CompletableFuture<Server> {
24+
return getServerById(System.getenv("SIMPLECLOUD_UNIQUE_ID"))
25+
}
26+
2027
/**
2128
* @param id the id of the server.
2229
* @return a [CompletableFuture] with the [Server].
@@ -124,6 +131,13 @@ interface ServerApi {
124131
*/
125132
suspend fun getAllServers(): List<Server>
126133

134+
/**
135+
* @return the [Server] from the SIMPLECLOUD_UNIQUE_ID environment
136+
*/
137+
suspend fun thisServer(): Server {
138+
return getServerById(System.getenv("SIMPLECLOUD_UNIQUE_ID"))
139+
}
140+
127141
/**
128142
* @param id the id of the server.
129143
* @return the [Server].

0 commit comments

Comments
 (0)