User: import com.google.common.collect.ImmutableMap;
import gg.blockgame.hub.HubServer;
import gg.blockgame.server.BlockgameServer;
import gg.blockgame.server.ServerType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;

public class Blockgame {

    public static final Logger LOGGER = LoggerFactory.getLogger(Blockgame.class);
    private static final Map<String, Class<? extends ServerType>> types = ImmutableMap.of(
            "HUB", HubServer.class
    );

    public static void main(String[] args) {
        if (args.length != 1 || !types.containsKey(args[0])) {
            LOGGER.error("You must provide a valid ServerType to start server with.");
            LOGGER.info("Valid types: {}", String.join(", ", types.keySet()));
            LOGGER.info("Example Usage: java -jar Blockgame.jar HUB");
            return;
        }

        try {
            new BlockgameServer(types.get(args[0]).getDeclaredConstructor().newInstance()).init();
        } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
            LOGGER.error("Error while instantiating Blockgame server with type {}: {}", args[0], e.getMessage());
            LOGGER.error("Exception stack trace:", e);
        }
    }

}
convert to kotlin
Assistant: Converting Java code to Kotlin involves several steps, including using Kotlin-specific syntax, making use of Kotlin’s standard library functions, and respecting Kotlin’s null safety features. Below is a conversion of your provided Java code into Kotlin:  

    import com.google.common.collect.ImmutableMapimport gg.blockgame.hub.HubServerimport gg.blockgame.server.BlockgameServerimport gg.blockgame.server.ServerTypeimport org.slf4j.Loggerimport org.slf4j.LoggerFactoryclass Blockgame {    companion object {        val LOGGER: Logger = LoggerFactory.getLogger(Blockgame::class.java)        private val types: Map<String, Class<out ServerType>> = ImmutableMap.of(            “HUB”, HubServer::class.java        )        @JvmStatic        fun main(args: Array<String>) {            if (args.size != 1 || !types.containsKey(args[0])) {                LOGGER.error(“You must provide a valid ServerType to start server with.”)                LOGGER.info(“Valid types: {}”, types.keys.joinToString(", "))                LOGGER.info(“Example Usage: java -jar Blockgame.jar HUB”)                return            }            try {                val serverType = types[args[0]]                val serverInstance = serverType?.getDeclaredConstructor()?.newInstance()                serverInstance?.let {                    BlockgameServer(it).init()                }            } catch (e: Exception) {                LOGGER.error(“Error while instantiating Blockgame server with type {}: {}”, args[0], e.message)                LOGGER.error(“Exception stack trace:”, e)            }        }    }}

  
  
**Key Points in the Conversion:**  
1\. **Companion Object:** In Kotlin, static members are implemented using a `companion object`.  
2\. **Type Aliases:** The usage of `Class&lt;out ServerType&gt;` signifies that the map contains types that extend `ServerType`.  
3\. **Method References and Smart Casts:** The use of the `let` function ensures that we only call `init()` on a non-null instance of `BlockgameServer`.  
4\. **String Interpolation:** Kotlin uses string interpolation instead of the `String.format` method used frequently in Java.  
5\. **Exception Handling:** Kotlin’s `try-catch` block allows straightforward conversion, handling all exceptions generally with `Exception`.  
  
These key changes ensure that the code is idiomatic to Kotlin while maintaining the logic of the original Java implementation.
User: can you format the code block peroperly
Assistant: