update ktlint rules
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user