diff --git a/src/main/kotlin/com/xiaoyv404/mirai/app/minecraftServer/ISU.kt b/src/main/kotlin/com/xiaoyv404/mirai/app/minecraftServer/ISU.kt index d53a9b8..e7edce6 100644 --- a/src/main/kotlin/com/xiaoyv404/mirai/app/minecraftServer/ISU.kt +++ b/src/main/kotlin/com/xiaoyv404/mirai/app/minecraftServer/ISU.kt @@ -29,7 +29,7 @@ class ISU : NfApp(), IFshApp { override fun getAppDescription() = "我的世界玩家状态监控" - override fun getCommands() = arrayOf("-玩家状态", "-有妖怪在线吗", "-桃呢", "-有无妖怪", "-有妖怪在线吗") + override fun getCommands() = arrayOf("-玩家状态", "-有妖怪在线吗", "-桃呢", "-有无妖怪", "-有妖怪在吗") override fun getOptions() = NfOptions().apply { addOption("m", "more", false, "获取更多信息") diff --git a/src/main/kotlin/com/xiaoyv404/mirai/app/webAPI/router/mincreaftServer/player.kt b/src/main/kotlin/com/xiaoyv404/mirai/app/webAPI/router/mincreaftServer/player.kt index 2e1490b..4de1e4c 100644 --- a/src/main/kotlin/com/xiaoyv404/mirai/app/webAPI/router/mincreaftServer/player.kt +++ b/src/main/kotlin/com/xiaoyv404/mirai/app/webAPI/router/mincreaftServer/player.kt @@ -16,14 +16,31 @@ fun Route.player() { val data = MinecraftServerPlayer { this.id = id }.findById() ?: error(WebApi.requestError) - call.respond(NfResult.success(data)) + val apiModel = data.let { + MinecraftPlayerApiModel( + it.name, + it.id, + it.lastLoginTime.toString(), + it.lastLoginServer, + it.permissions + ) + } + call.respond(NfResult.success(apiModel)) } get("/players/search") { val name = call.request.queryParameters["name"] ?: error(WebApi.requestError) val data = MinecraftServerPlayer { this.name = name - }.findByName() + }.findByName().map { + MinecraftPlayerApiModel( + it.name, + it.id, + it.lastLoginTime.toString(), + it.lastLoginServer, + it.permissions + ) + } call.respond(NfResult.success(data)) } get("/players/online") {