update ktlint rules

This commit is contained in:
2025-03-14 03:23:16 +01:00
parent 492981bed0
commit b4234a9b37
97 changed files with 2392 additions and 2359 deletions

View File

@@ -15,32 +15,33 @@ import kotlinx.coroutines.channels.SendChannel
* This action can be executing an action and produce a new [GameEvent] after verification.
*/
class GameCommandHandler(
private val commandStreamChannel: CommandStreamChannelBuilder<GameCommand>,
private val runner: GameCommandRunner,
private val commandStreamChannel: CommandStreamChannelBuilder<GameCommand>,
private val runner: GameCommandRunner,
) {
private val logger = KotlinLogging.logger { }
private val logger = KotlinLogging.logger { }
/**
* Init the handler
*/
suspend fun handle(
player: Player,
incomingCommandChannel: ReceiveChannel<GameCommand>,
outgoingErrorChannelNotification: SendChannel<Notification>,
) = commandStreamChannel(incomingCommandChannel)
.process { command ->
if (command.payload.player.id != player.id) {
logger.atWarn {
message = "Handle command Refuse, the player of the command is not the same: $command"
payload = mapOf("command" to command)
}
nack()
} else {
logger.atInfo {
message = "Handle command: $command"
payload = mapOf("command" to command)
}
runner.run(command, outgoingErrorChannelNotification)
}
/**
* Init the handler
*/
suspend fun handle(
player: Player,
incomingCommandChannel: ReceiveChannel<GameCommand>,
outgoingErrorChannelNotification: SendChannel<Notification>,
) =
commandStreamChannel(incomingCommandChannel)
.process { command ->
if (command.payload.player.id != player.id) {
logger.atWarn {
message = "Handle command Refuse, the player of the command is not the same: $command"
payload = mapOf("command" to command)
}
nack()
} else {
logger.atInfo {
message = "Handle command: $command"
payload = mapOf("command" to command)
}
runner.run(command, outgoingErrorChannelNotification)
}
}
}