feat: Connecting to a game
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
package cz.jzitnik.common.socket.messages.game.connection;
|
||||
|
||||
import cz.jzitnik.common.socket.SocketMessage;
|
||||
|
||||
public record ConnectToAGame(String gamePass) implements SocketMessage {
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cz.jzitnik.common.socket.messages.game.connection;
|
||||
|
||||
import cz.jzitnik.common.models.player.PlayerCreation;
|
||||
import cz.jzitnik.common.socket.SocketMessage;
|
||||
|
||||
public record ConnectToAGameResponse(ResponseType responseType, PlayerCreation playerCreation) implements SocketMessage {
|
||||
private enum ResponseType {
|
||||
GAME_DOES_NOT_EXIST,
|
||||
SUCCESS
|
||||
}
|
||||
|
||||
public ConnectToAGameResponse() {
|
||||
this(ResponseType.GAME_DOES_NOT_EXIST, null);
|
||||
}
|
||||
|
||||
public ConnectToAGameResponse(PlayerCreation playerCreation) {
|
||||
this(ResponseType.SUCCESS, playerCreation);
|
||||
}
|
||||
|
||||
public boolean success() {
|
||||
return responseType == ResponseType.SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user