refactor: used ParticipantType from Gamelib
This commit is contained in:
parent
c0918f982f
commit
7f4e5cc1cb
2
Gamelib
2
Gamelib
@ -1 +1 @@
|
|||||||
Subproject commit d4e0ed23bcef8212b38050388afd907b9d50a7f1
|
Subproject commit 78d3fb84d0d9cf34ce5d206df1b312a8f122246e
|
@ -1,9 +0,0 @@
|
|||||||
package uulm.teamname.marvelous.server;
|
|
||||||
|
|
||||||
/** Specifies a participant type. */
|
|
||||||
public enum ParticipantType {
|
|
||||||
None,
|
|
||||||
Player1,
|
|
||||||
Player2,
|
|
||||||
Spectator
|
|
||||||
}
|
|
@ -5,7 +5,7 @@ import uulm.teamname.marvelous.gamelibrary.events.Event;
|
|||||||
import uulm.teamname.marvelous.gamelibrary.events.EventBuilder;
|
import uulm.teamname.marvelous.gamelibrary.events.EventBuilder;
|
||||||
import uulm.teamname.marvelous.gamelibrary.events.EventType;
|
import uulm.teamname.marvelous.gamelibrary.events.EventType;
|
||||||
import uulm.teamname.marvelous.gamelibrary.gamelogic.GameInstance;
|
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.CharacterConfig;
|
||||||
import uulm.teamname.marvelous.gamelibrary.config.PartyConfig;
|
import uulm.teamname.marvelous.gamelibrary.config.PartyConfig;
|
||||||
import uulm.teamname.marvelous.gamelibrary.config.ScenarioConfig;
|
import uulm.teamname.marvelous.gamelibrary.config.ScenarioConfig;
|
||||||
@ -140,7 +140,7 @@ public class Lobby {
|
|||||||
public void generateWin(Participant winner){
|
public void generateWin(Participant winner){
|
||||||
connection.broadcastEvents(
|
connection.broadcastEvents(
|
||||||
new EventBuilder(EventType.WinEvent)
|
new EventBuilder(EventType.WinEvent)
|
||||||
.withPlayerWon(winner.type.equals(ParticipantType.Player1) ? 1 : 2)
|
.withPlayerWon(winner.type.equals(ParticipantType.PlayerOne) ? 1 : 2)
|
||||||
.buildGameStateEvent(),
|
.buildGameStateEvent(),
|
||||||
new EventBuilder(EventType.DisconnectEvent)
|
new EventBuilder(EventType.DisconnectEvent)
|
||||||
.buildGameStateEvent());
|
.buildGameStateEvent());
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package uulm.teamname.marvelous.server.lobby;
|
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 uulm.teamname.marvelous.server.lobbymanager.Participant;
|
||||||
|
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
|
@ -2,7 +2,7 @@ package uulm.teamname.marvelous.server.lobby.pipelining;
|
|||||||
|
|
||||||
import org.tinylog.Logger;
|
import org.tinylog.Logger;
|
||||||
import uulm.teamname.marvelous.gamelibrary.events.Event;
|
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.gamelibrary.requests.RequestType;
|
||||||
import uulm.teamname.marvelous.server.lobby.Lobby;
|
import uulm.teamname.marvelous.server.lobby.Lobby;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package uulm.teamname.marvelous.server.lobbymanager;
|
package uulm.teamname.marvelous.server.lobbymanager;
|
||||||
|
|
||||||
import uulm.teamname.marvelous.gamelibrary.events.Event;
|
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 uulm.teamname.marvelous.server.lobby.Lobby;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -30,10 +30,10 @@ public class MessageRelay {
|
|||||||
|
|
||||||
public void sendMessage (LobbyConnection origin, Participant recipient, Event[] events) {
|
public void sendMessage (LobbyConnection origin, Participant recipient, Event[] events) {
|
||||||
switch (recipient.type) {
|
switch (recipient.type) {
|
||||||
case Player1 -> {
|
case PlayerOne -> {
|
||||||
|
|
||||||
}
|
}
|
||||||
case Player2 -> {
|
case PlayerTwo -> {
|
||||||
|
|
||||||
}
|
}
|
||||||
case Spectator -> {
|
case Spectator -> {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package uulm.teamname.marvelous.server.lobbymanager;
|
package uulm.teamname.marvelous.server.lobbymanager;
|
||||||
|
|
||||||
import org.java_websocket.WebSocket;
|
import org.java_websocket.WebSocket;
|
||||||
import uulm.teamname.marvelous.server.ParticipantType;
|
import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user