From 1d4887d4e8be7fb4f4e153e56f21b1911b3f2292 Mon Sep 17 00:00:00 2001 From: Niklas <57962465+niklasnieberler@users.noreply.github.com> Date: Sat, 11 Jan 2025 16:41:14 +0100 Subject: [PATCH 1/3] feat: add thisServer method in ServerApi --- .../app/simplecloud/controller/api/ServerApi.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt b/controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt index 383ccbf..5c8e098 100644 --- a/controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt +++ b/controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt @@ -17,6 +17,13 @@ interface ServerApi { */ fun getAllServers(): CompletableFuture> + /** + * @return a [CompletableFuture] with the [Server] from the SIMPLECLOUD_UNIQUE_ID environment + */ + fun thisServer(): CompletableFuture { + return getServerById(System.getenv("SIMPLECLOUD_UNIQUE_ID")) + } + /** * @param id the id of the server. * @return a [CompletableFuture] with the [Server]. @@ -124,6 +131,13 @@ interface ServerApi { */ suspend fun getAllServers(): List + /** + * @return the [Server] from the SIMPLECLOUD_UNIQUE_ID environment + */ + suspend fun thisServer(): Server { + return getServerById(System.getenv("SIMPLECLOUD_UNIQUE_ID")) + } + /** * @param id the id of the server. * @return the [Server]. From 6ebee1bcfc7b41ddb87cbcc3c5e0dae328e0d21b Mon Sep 17 00:00:00 2001 From: Niklas <57962465+niklasnieberler@users.noreply.github.com> Date: Sat, 11 Jan 2025 16:53:11 +0100 Subject: [PATCH 2/3] ref: rename thisServer to getThisServer in ServerApi --- .../main/kotlin/app/simplecloud/controller/api/ServerApi.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt b/controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt index 5c8e098..703e357 100644 --- a/controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt +++ b/controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt @@ -20,7 +20,7 @@ interface ServerApi { /** * @return a [CompletableFuture] with the [Server] from the SIMPLECLOUD_UNIQUE_ID environment */ - fun thisServer(): CompletableFuture { + fun getThisServer(): CompletableFuture { return getServerById(System.getenv("SIMPLECLOUD_UNIQUE_ID")) } @@ -134,7 +134,7 @@ interface ServerApi { /** * @return the [Server] from the SIMPLECLOUD_UNIQUE_ID environment */ - suspend fun thisServer(): Server { + suspend fun getThisServer(): Server { return getServerById(System.getenv("SIMPLECLOUD_UNIQUE_ID")) } From 3e8cec222fb0fbb0ef0cc3a4011c0f0f23f7b50c Mon Sep 17 00:00:00 2001 From: Niklas <57962465+niklasnieberler@users.noreply.github.com> Date: Sat, 11 Jan 2025 16:54:35 +0100 Subject: [PATCH 3/3] ref: rename thisServer to getCurrentServer in ServerApi --- .../main/kotlin/app/simplecloud/controller/api/ServerApi.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt b/controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt index 703e357..0b31653 100644 --- a/controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt +++ b/controller-api/src/main/kotlin/app/simplecloud/controller/api/ServerApi.kt @@ -20,7 +20,7 @@ interface ServerApi { /** * @return a [CompletableFuture] with the [Server] from the SIMPLECLOUD_UNIQUE_ID environment */ - fun getThisServer(): CompletableFuture { + fun getCurrentServer(): CompletableFuture { return getServerById(System.getenv("SIMPLECLOUD_UNIQUE_ID")) } @@ -134,7 +134,7 @@ interface ServerApi { /** * @return the [Server] from the SIMPLECLOUD_UNIQUE_ID environment */ - suspend fun getThisServer(): Server { + suspend fun getCurrentServer(): Server { return getServerById(System.getenv("SIMPLECLOUD_UNIQUE_ID")) }