-
Notifications
You must be signed in to change notification settings - Fork 0
More cloud like #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TheBjoRedCraft
wants to merge
14
commits into
version/26.1
Choose a base branch
from
more-cloud-like
base: version/26.1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
More cloud like #44
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c4f7bd5
feat: implement core command and service commands with shutdown and e…
TheBjoRedCraft f336815
feat: add service list command to display active servers with player …
TheBjoRedCraft e3f59b5
feat: enhance core command with player and service management functio…
TheBjoRedCraft 666931a
feat: add player join event handler to customize display name
TheBjoRedCraft cecb2ce
feat: integrate LuckPerms event handling to update player display names
TheBjoRedCraft 99f8bde
feat: add SurfPlayerErrorsTable to database table imports in CoreMicr…
TheBjoRedCraft 980472d
feat: enhance SurfPlayerErrorHandler to respond with error details af…
TheBjoRedCraft 76c2b14
feat: update network broadcast command to include formatted info prefix
TheBjoRedCraft 6b2eec3
feat: add newline after info message in NetworkBroadcastCommand
TheBjoRedCraft 7802219
feat: add core prefix to info messages in NetworkBroadcastCommand
TheBjoRedCraft fb3b2e5
feat: implement CorePlayerInfoProvider interface and default implemen…
TheBjoRedCraft 9030b15
Potential fix for pull request finding
TheBjoRedCraft 879f65e
fix: update server display name in ServerInfo and improve core versio…
TheBjoRedCraft 4e8e97c
refactor: simplify player display name handling in onJoin event
TheBjoRedCraft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| kotlin.code.style=official | ||
| kotlin.stdlib.default.dependency=false | ||
| org.gradle.parallel=true | ||
| version=2.2.1-SNAPSHOT | ||
| version=2.3.0-SNAPSHOT |
38 changes: 38 additions & 0 deletions
38
...urf-core-api-paper/src/main/kotlin/dev/slne/surf/core/api/paper/CorePlayerInfoProvider.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package dev.slne.surf.core.api.paper | ||
|
|
||
| import dev.slne.surf.core.api.paper.CorePlayerInfoProvider.Companion.getServerInfo | ||
| import java.util.* | ||
|
|
||
| interface CorePlayerInfoProvider { | ||
| fun createServerInfo(playerUuid: UUID): ServerInfo? | ||
|
|
||
| /** | ||
| * Server Info data class containing the server name, nice name and region. This is used to provide information about the server a player is currently on. | ||
| * | ||
| * @param serverName The name of the server the player is currently on. | ||
| * @param serverDisplayName The nice name of the server the player is currently on. | ||
| * @param serverRegion The region of the server the player is currently on. | ||
| * | ||
| * NOTE: This method should not be used to gain access to players current server. Use [dev.slne.surf.core.api.common.player.SurfPlayer.currentServer] instead. | ||
| * | ||
| * @see [getServerInfo] | ||
| */ | ||
| data class ServerInfo( | ||
| val serverName: String, | ||
| val serverDisplayName: String, | ||
| val serverRegion: String | ||
| ) | ||
|
|
||
| companion object { | ||
| private lateinit var instance: CorePlayerInfoProvider | ||
|
TheBjoRedCraft marked this conversation as resolved.
|
||
|
|
||
| fun setInstance(provider: CorePlayerInfoProvider) { | ||
| instance = provider | ||
| } | ||
|
|
||
| /** | ||
| * Available after plugin bootstrapper | ||
| */ | ||
| fun getServerInfo(playerUuid: UUID) = instance.createServerInfo(playerUuid) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
.../main/kotlin/dev/slne/surf/core/core/common/redis/listener/ExecuteCommandRedisListener.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package dev.slne.surf.core.core.common.redis.listener | ||
|
|
||
| import dev.slne.surf.core.core.common.redis.request.ExecuteCommandServerRequest | ||
| import dev.slne.surf.redis.request.HandleRedisRequest | ||
| import dev.slne.surf.redis.request.RequestContext | ||
|
|
||
| object ExecuteCommandRedisListener { | ||
| @HandleRedisRequest | ||
| suspend fun handleExecuteCommandRequest(context: RequestContext<ExecuteCommandServerRequest.Request>) { | ||
| RemoteCommandExecutor.executeCommand( | ||
| context.request.commonSurfServer, | ||
| context.request.command | ||
| )?.let { | ||
| context.respond( | ||
| ExecuteCommandServerRequest.Response( | ||
| it | ||
| ) | ||
| ) | ||
| } | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
...on/src/main/kotlin/dev/slne/surf/core/core/common/redis/listener/RemoteCommandExecutor.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package dev.slne.surf.core.core.common.redis.listener | ||
|
|
||
| import dev.slne.surf.api.core.util.requiredService | ||
| import dev.slne.surf.core.api.common.server.CommonSurfServer | ||
|
|
||
| private val listener = requiredService<RemoteCommandExecutor>() | ||
|
|
||
| interface RemoteCommandExecutor { | ||
| suspend fun executeCommand(commonSurfServer: CommonSurfServer, command: String): Boolean? | ||
|
|
||
| companion object : | ||
| RemoteCommandExecutor by listener | ||
| } |
13 changes: 13 additions & 0 deletions
13
...on/src/main/kotlin/dev/slne/surf/core/core/common/redis/listener/ServerShutdownHandler.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package dev.slne.surf.core.core.common.redis.listener | ||
|
|
||
| import dev.slne.surf.api.core.util.requiredService | ||
| import dev.slne.surf.core.api.common.server.CommonSurfServer | ||
| import net.kyori.adventure.text.Component | ||
|
|
||
| private val listener = requiredService<ServerShutdownHandler>() | ||
|
|
||
| interface ServerShutdownHandler { | ||
| fun shutdown(commonSurfServer: CommonSurfServer, reason: Component?): Boolean? | ||
|
|
||
| companion object : ServerShutdownHandler by listener | ||
| } |
22 changes: 22 additions & 0 deletions
22
.../main/kotlin/dev/slne/surf/core/core/common/redis/listener/ShutdownServerRedisListener.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package dev.slne.surf.core.core.common.redis.listener | ||
|
|
||
| import dev.slne.surf.core.core.common.redis.request.ShutdownServerRequest | ||
| import dev.slne.surf.redis.request.HandleRedisRequest | ||
| import dev.slne.surf.redis.request.RequestContext | ||
|
|
||
| object ShutdownServerRedisListener { | ||
| @HandleRedisRequest | ||
| fun handleShutdownRequest(context: RequestContext<ShutdownServerRequest.Request>) { | ||
|
TheBjoRedCraft marked this conversation as resolved.
|
||
| ServerShutdownHandler.shutdown( | ||
| context.request.commonSurfServer, | ||
| context.request.reason | ||
| )?.let { | ||
| context.respond( | ||
| ShutdownServerRequest.Response( | ||
| it | ||
| ) | ||
| ) | ||
| } | ||
|
|
||
| } | ||
| } | ||
29 changes: 29 additions & 0 deletions
29
...c/main/kotlin/dev/slne/surf/core/core/common/redis/request/ExecuteCommandServerRequest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package dev.slne.surf.core.core.common.redis.request | ||
|
|
||
| import dev.slne.surf.core.api.common.server.CommonSurfServer | ||
| import dev.slne.surf.core.core.CoreInstance | ||
| import dev.slne.surf.redis.request.RedisRequest | ||
| import dev.slne.surf.redis.request.RedisResponse | ||
| import kotlinx.serialization.Serializable | ||
| import kotlin.time.Duration.Companion.seconds | ||
|
|
||
| object ExecuteCommandServerRequest { | ||
| @Serializable | ||
| data class Request( | ||
| val commonSurfServer: CommonSurfServer, | ||
| val command: String | ||
| ) : RedisRequest() | ||
|
|
||
| @Serializable | ||
| data class Response( | ||
| val status: Boolean | ||
| ) : RedisResponse() | ||
|
|
||
| suspend fun createRequest(commonSurfServer: CommonSurfServer, command: String) = | ||
| runCatching { | ||
| CoreInstance.redisApi.sendRequest<Response>( | ||
| Request(commonSurfServer, command), | ||
| 10.seconds.inWholeMilliseconds | ||
| ) | ||
| }.getOrNull() ?: Response(false) | ||
| } |
31 changes: 31 additions & 0 deletions
31
...mon/src/main/kotlin/dev/slne/surf/core/core/common/redis/request/ShutdownServerRequest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package dev.slne.surf.core.core.common.redis.request | ||
|
|
||
| import dev.slne.surf.api.core.serializer.adventure.component.SerializableComponent | ||
| import dev.slne.surf.core.api.common.server.CommonSurfServer | ||
| import dev.slne.surf.core.core.CoreInstance | ||
| import dev.slne.surf.redis.request.RedisRequest | ||
| import dev.slne.surf.redis.request.RedisResponse | ||
| import kotlinx.serialization.Serializable | ||
| import net.kyori.adventure.text.Component | ||
| import kotlin.time.Duration.Companion.seconds | ||
|
|
||
| object ShutdownServerRequest { | ||
| @Serializable | ||
| data class Request( | ||
| val commonSurfServer: CommonSurfServer, | ||
| val reason: SerializableComponent? | ||
| ) : RedisRequest() | ||
|
|
||
| @Serializable | ||
| data class Response( | ||
| val status: Boolean | ||
| ) : RedisResponse() | ||
|
|
||
| suspend fun createRequest(commonSurfServer: CommonSurfServer, reason: Component?) = | ||
| runCatching { | ||
| CoreInstance.redisApi.sendRequest<Response>( | ||
| Request(commonSurfServer, reason), | ||
| 10.seconds.inWholeMilliseconds | ||
| ) | ||
| }.getOrNull() ?: Response(false) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 11 additions & 6 deletions
17
...oservice/src/main/kotlin/dev/slne/surf/core/microservice/rabbit/SurfPlayerErrorHandler.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,24 @@ | ||
| package dev.slne.surf.core.microservice.rabbit | ||
|
|
||
| import dev.slne.surf.core.core.common.rabbit.packet.player.error.SaveSurfPlayerErrorRequestPacket | ||
| import dev.slne.surf.core.core.common.rabbit.packet.player.error.SingleSurfPlayerErrorResponsePacket | ||
| import dev.slne.surf.core.microservice.database.repository.SurfPlayerErrorRepository | ||
| import dev.slne.surf.rabbitmq.api.handler.RabbitHandler | ||
| import kotlinx.coroutines.launch | ||
|
|
||
| object SurfPlayerErrorHandler { | ||
| @RabbitHandler | ||
| fun handleSavePlayerError(packet: SaveSurfPlayerErrorRequestPacket) = packet.launch { | ||
| SurfPlayerErrorRepository.saveError( | ||
| playerUuid = packet.playerUuid, | ||
| occurredOn = packet.occurredOn, | ||
| occurredAt = packet.occurredAt, | ||
| staffMessage = packet.staffMessage, | ||
| errorCode = packet.errorCode | ||
| packet.respond( | ||
| SingleSurfPlayerErrorResponsePacket( | ||
| SurfPlayerErrorRepository.saveError( | ||
| playerUuid = packet.playerUuid, | ||
| occurredOn = packet.occurredOn, | ||
| occurredAt = packet.occurredAt, | ||
| staffMessage = packet.staffMessage, | ||
| errorCode = packet.errorCode | ||
| ) | ||
| ) | ||
| ) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.