summaryrefslogtreecommitdiff
path: root/shared/src/main/java/kz/ilotterytea/frogartha/utils/SerializerUtils.java
blob: e00593711159ba5d4c27c5c242185a370ccbfeb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package kz.ilotterytea.frogartha.utils;

import com.github.czyzby.websocket.serialization.impl.ManualSerializer;
import kz.ilotterytea.frogartha.domain.Identity;
import kz.ilotterytea.frogartha.domain.actions.ChangedDirectionAction;
import kz.ilotterytea.frogartha.domain.actions.JoinRoomAction;
import kz.ilotterytea.frogartha.domain.actions.LeaveRoomAction;
import kz.ilotterytea.frogartha.domain.actions.PlayerJumpAction;
import kz.ilotterytea.frogartha.domain.events.*;
import kz.ilotterytea.frogartha.exceptions.PlayerKickException;

public class SerializerUtils {
    public static void registerTypes(ManualSerializer serializer) {
        serializer.register(new Identity());
        serializer.register(new PlayerKickException());
        serializer.register(new PlayerJumpAction());
        serializer.register(new PlayerJumpEvent());
        serializer.register(new ChangedDirectionAction());
        serializer.register(new ChangedDirectionEvent());
        serializer.register(new IdentifiedEvent());

        serializer.register(new JoinRoomAction());
        serializer.register(new PlayerJoinedRoomEvent());
        serializer.register(new SenderJoinedRoomEvent());

        serializer.register(new LeaveRoomAction());
        serializer.register(new PlayerLeftRoomEvent());
        serializer.register(new SenderLeftRoomEvent());
    }
}