From d2d9712b61cadcf6f379a141535f35ec7040571b Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Wed, 19 May 2021 20:59:11 +0200 Subject: [PATCH] fix: fixed types in MessageRelay and LobbyConnection --- .../marvelous/server/Lobby/pipelining/PauseSegment.java | 2 ++ .../marvelous/server/Lobby/{ => pipelining}/Pipeline.java | 0 .../marvelous/server/Lobby/{ => pipelining}/Segment.java | 0 .../marvelous/server/LobbyManager/LobbyConnection.java | 4 ++-- .../teamname/marvelous/server/LobbyManager/MessageRelay.java | 2 +- .../marvelous/server/Lobby/pipelining/PauseSegmentTest.java | 5 +++++ 6 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 Server/src/main/java/uulm/teamname/marvelous/server/Lobby/pipelining/PauseSegment.java rename Server/src/main/java/uulm/teamname/marvelous/server/Lobby/{ => pipelining}/Pipeline.java (100%) rename Server/src/main/java/uulm/teamname/marvelous/server/Lobby/{ => pipelining}/Segment.java (100%) create mode 100644 Server/src/test/java/uulm/teamname/marvelous/server/Lobby/pipelining/PauseSegmentTest.java diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/Lobby/pipelining/PauseSegment.java b/Server/src/main/java/uulm/teamname/marvelous/server/Lobby/pipelining/PauseSegment.java new file mode 100644 index 0000000..bf86d15 --- /dev/null +++ b/Server/src/main/java/uulm/teamname/marvelous/server/Lobby/pipelining/PauseSegment.java @@ -0,0 +1,2 @@ +package uulm.teamname.marvelous.server.Lobby.pipelining;public class PauseSegment { +} diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/Lobby/Pipeline.java b/Server/src/main/java/uulm/teamname/marvelous/server/Lobby/pipelining/Pipeline.java similarity index 100% rename from Server/src/main/java/uulm/teamname/marvelous/server/Lobby/Pipeline.java rename to Server/src/main/java/uulm/teamname/marvelous/server/Lobby/pipelining/Pipeline.java diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/Lobby/Segment.java b/Server/src/main/java/uulm/teamname/marvelous/server/Lobby/pipelining/Segment.java similarity index 100% rename from Server/src/main/java/uulm/teamname/marvelous/server/Lobby/Segment.java rename to Server/src/main/java/uulm/teamname/marvelous/server/Lobby/pipelining/Segment.java diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/LobbyManager/LobbyConnection.java b/Server/src/main/java/uulm/teamname/marvelous/server/LobbyManager/LobbyConnection.java index 7ee0699..12ca266 100644 --- a/Server/src/main/java/uulm/teamname/marvelous/server/LobbyManager/LobbyConnection.java +++ b/Server/src/main/java/uulm/teamname/marvelous/server/LobbyManager/LobbyConnection.java @@ -94,8 +94,8 @@ public class LobbyConnection { } - public boolean contains(WebSocket webSocket) { - return player1 == webSocket || player2 == webSocket || spectators.contains(webSocket); + public boolean contains(Participant participant) { + return player1 == participant || player2 == participant || spectators.contains(participant); } // Methods to send events diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/LobbyManager/MessageRelay.java b/Server/src/main/java/uulm/teamname/marvelous/server/LobbyManager/MessageRelay.java index a2a3584..90adf9e 100644 --- a/Server/src/main/java/uulm/teamname/marvelous/server/LobbyManager/MessageRelay.java +++ b/Server/src/main/java/uulm/teamname/marvelous/server/LobbyManager/MessageRelay.java @@ -31,7 +31,7 @@ public class MessageRelay { } public void sendMessage (LobbyConnection origin, Participant recipient, Event[] events) { - switch (target) { + switch (recipient.type) { case Player1 -> { } diff --git a/Server/src/test/java/uulm/teamname/marvelous/server/Lobby/pipelining/PauseSegmentTest.java b/Server/src/test/java/uulm/teamname/marvelous/server/Lobby/pipelining/PauseSegmentTest.java new file mode 100644 index 0000000..7a0e1e7 --- /dev/null +++ b/Server/src/test/java/uulm/teamname/marvelous/server/Lobby/pipelining/PauseSegmentTest.java @@ -0,0 +1,5 @@ +import static org.mockito.Mockito.*; +import static org.junit.jupiter.api.Assertions.*; +class PauseSegmentTest { + +} \ No newline at end of file