diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/server/ChatHandler.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/server/ChatHandler.kt index c99a67bb..72288fa9 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/server/ChatHandler.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/server/ChatHandler.kt @@ -19,6 +19,15 @@ class ChatHandler(val server: StarboundServer) { )) } + fun systemMessage(target: ServerConnection, string: String) { + target.send(ChatReceivePacket( + ChatMessage( + MessageContext.BROADCAST, + text = string + ) + )) + } + fun handle(source: ServerConnection, packet: ChatSendPacket) { when (packet.mode) { ChatSendMode.BROADCAST -> { diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/server/world/ServerWorld.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/server/world/ServerWorld.kt index 628acf91..7e85a33c 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/server/world/ServerWorld.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/server/world/ServerWorld.kt @@ -208,6 +208,7 @@ class ServerWorld private constructor( clients.forEach { LOGGER.info("Kicking ${it.client.alias()} off dying world") it.remove("World shutting down", setReturnWarp = !uncleanShutdown) + server.chat.systemMessage(it.client, "You were kicked from current world due to it being shut down") if (!server.isShutdown) it.client.enqueueWarp(WarpAlias.Return) @@ -807,7 +808,7 @@ class ServerWorld private constructor( tickets.addAll(region) region.forEach { it.chunk.await() } - foundGround = anyCellSatisfies(spawnRect) { tx, ty, tcell -> + foundGround = chunkMap.anyCellSatisfies(spawnRect) { tx, ty, tcell -> tcell.foreground.material.value.collisionKind != CollisionType.NONE } @@ -837,7 +838,7 @@ class ServerWorld private constructor( tickets.addAll(region) region.forEach { it.chunk.await() } - if (!anyCellSatisfies(spawnRect) { tx, ty, tcell -> tcell.foreground.material.value.collisionKind != CollisionType.NONE } && spawnRect.maxs.y < geometry.size.y) { + if (!chunkMap.anyCellSatisfies(spawnRect) { tx, ty, tcell -> tcell.foreground.material.value.collisionKind != CollisionType.NONE } && spawnRect.maxs.y < geometry.size.y) { LOGGER.debug("Found appropriate spawn position at {}", pos) return pos }