refactor: used ParticipantType from Gamelib

This commit is contained in:
Yannik Bretschneider 2021-06-03 23:40:17 +02:00
parent c0918f982f
commit 7f4e5cc1cb
8 changed files with 10 additions and 18 deletions

@ -1 +1 @@
Subproject commit d4e0ed23bcef8212b38050388afd907b9d50a7f1
Subproject commit 78d3fb84d0d9cf34ce5d206df1b312a8f122246e

View File

@ -1,9 +0,0 @@
package uulm.teamname.marvelous.server;
/** Specifies a participant type. */
public enum ParticipantType {
None,
Player1,
Player2,
Spectator
}

View File

@ -5,7 +5,7 @@ import uulm.teamname.marvelous.gamelibrary.events.Event;
import uulm.teamname.marvelous.gamelibrary.events.EventBuilder;
import uulm.teamname.marvelous.gamelibrary.events.EventType;
import uulm.teamname.marvelous.gamelibrary.gamelogic.GameInstance;
import uulm.teamname.marvelous.server.ParticipantType;
import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType;
import uulm.teamname.marvelous.gamelibrary.config.CharacterConfig;
import uulm.teamname.marvelous.gamelibrary.config.PartyConfig;
import uulm.teamname.marvelous.gamelibrary.config.ScenarioConfig;
@ -140,7 +140,7 @@ public class Lobby {
public void generateWin(Participant winner){
connection.broadcastEvents(
new EventBuilder(EventType.WinEvent)
.withPlayerWon(winner.type.equals(ParticipantType.Player1) ? 1 : 2)
.withPlayerWon(winner.type.equals(ParticipantType.PlayerOne) ? 1 : 2)
.buildGameStateEvent(),
new EventBuilder(EventType.DisconnectEvent)
.buildGameStateEvent());

View File

@ -1,6 +1,7 @@
package uulm.teamname.marvelous.server.lobby;
import uulm.teamname.marvelous.server.ParticipantType;
import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType;
import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType;
import uulm.teamname.marvelous.server.lobbymanager.Participant;
import java.util.Timer;

View File

@ -2,7 +2,7 @@ package uulm.teamname.marvelous.server.lobby.pipelining;
import org.tinylog.Logger;
import uulm.teamname.marvelous.gamelibrary.events.Event;
import uulm.teamname.marvelous.server.ParticipantType;
import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType;
import uulm.teamname.marvelous.gamelibrary.requests.RequestType;
import uulm.teamname.marvelous.server.lobby.Lobby;

View File

@ -1,7 +1,7 @@
package uulm.teamname.marvelous.server.lobbymanager;
import uulm.teamname.marvelous.gamelibrary.events.Event;
import uulm.teamname.marvelous.server.ParticipantType;
import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType;
import uulm.teamname.marvelous.server.lobby.Lobby;
import java.util.HashSet;

View File

@ -30,10 +30,10 @@ public class MessageRelay {
public void sendMessage (LobbyConnection origin, Participant recipient, Event[] events) {
switch (recipient.type) {
case Player1 -> {
case PlayerOne -> {
}
case Player2 -> {
case PlayerTwo -> {
}
case Spectator -> {

View File

@ -1,7 +1,7 @@
package uulm.teamname.marvelous.server.lobbymanager;
import org.java_websocket.WebSocket;
import uulm.teamname.marvelous.server.ParticipantType;
import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType;
import java.util.Objects;