package hwo.kurjatturskat.core.message;

public enum MessageType {

    // NOTE: Enums must be in small letter for json to be outputted correctly
    carPositions("carPositions"), yourCar("yourCar"), join("join"), gameInit(
            "gameInit"), gameStart("gameStart"), throttle("throttle"), switchLane(
            "switchLane"), unknown("unknown"), lapFinished("lapFinished"), spawn(
            "spawn"), crash("crash"), finish("finish"), gameEnd("gameEnd");

    private final String type;

    MessageType(String type) {
        this.type = type;
    }

    public String getType() {
        return this.type;
    }

    public static MessageType get(String type) {
        for (MessageType enumType : MessageType.values()) {
            if (enumType.getType().equals(type)) {
                return enumType;
            }
        }
        return unknown;
    }

}

@@ -108,61 +108,104 @@
 ter 
-for json to be outputted correctly%0A    carPositions(%22
+and match to the msgType field value%0A    // in the messages. Otherwise gson cannot map them%0A    
 carP
@@ -212,18 +212,16 @@
 ositions
-%22)
 , yourCa
@@ -225,692 +225,111 @@
 rCar
-(%22yourCar%22), join(%22join%22), gameInit(%0A            %22gameInit%22), gameStart(%22gameStart%22), throttle(%22throttle%22), switchLane(%0A            %22switchLane%22), unknown(%22unknown%22), lapFinished(%22lapFinished%22), spawn(%0A            %22spawn%22), crash(%22crash%22), finish(%22finish%22), gameEnd(%22gameEnd%22);%0A%0A    private final String type;%0A%0A    MessageType(String type) %7B%0A        this.type = type;%0A    %7D%0A%0A    public String getType() %7B%0A        return this.type;%0A    %7D%0A%0A    public static MessageType get(String type) %7B%0A        for (MessageType enumType : MessageType.values()) %7B%0A            if (enumType.getType().equals(type)) %7B%0A                return enumType;%0A            %7D%0A        %7D%0A        return unknown;%0A    %7D
+, join, gameInit, gameStart, throttle, switchLane, unknown, lapFinished, spawn, crash, finish, gameEnd;
 %0A%0A%7D%0A

Remove the parameterized enum as it could not be used with gson