diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/events/Event.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/events/Event.java index e554545..d32d0e9 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/events/Event.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/events/Event.java @@ -2,7 +2,7 @@ package uulm.teamname.marvelous.gamelibrary.events; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import uulm.teamname.marvelous.gamelibrary.messages.EventMessage; +import uulm.teamname.marvelous.gamelibrary.messages.server.EventMessage; import uulm.teamname.marvelous.gamelibrary.json.ingame.deserialize.EventDeserializer; import uulm.teamname.marvelous.gamelibrary.json.ingame.serialize.EventSerializer; diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/json/JSON.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/json/JSON.java index 0d8ad50..2063b2e 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/json/JSON.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/json/JSON.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.InjectableValues; import com.fasterxml.jackson.databind.ObjectMapper; import uulm.teamname.marvelous.gamelibrary.config.CharacterConfig; import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; -import uulm.teamname.marvelous.gamelibrary.messages.EventMessage; +import uulm.teamname.marvelous.gamelibrary.messages.server.EventMessage; /** * Class that contains JSON encoding and decoding. It is initiated with the Character configuration. diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/Assignment.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/AssignmentEnum.java similarity index 77% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/Assignment.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/AssignmentEnum.java index cbcf67b..307d6d7 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/Assignment.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/AssignmentEnum.java @@ -1,6 +1,6 @@ package uulm.teamname.marvelous.gamelibrary.messages; -public enum Assignment { +public enum AssignmentEnum { PlayerOne, PlayerTwo, Spectator diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/BasicMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/BasicMessage.java index f37fdec..779b4cb 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/BasicMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/BasicMessage.java @@ -1,10 +1,11 @@ package uulm.teamname.marvelous.gamelibrary.messages; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes.Type; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import uulm.teamname.marvelous.gamelibrary.messages.client.*; +import uulm.teamname.marvelous.gamelibrary.messages.server.*; import java.util.Objects; diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/CharacterSelectionMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/CharacterSelectionMessage.java similarity index 85% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/CharacterSelectionMessage.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/CharacterSelectionMessage.java index 63c8fb3..98ecb32 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/CharacterSelectionMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/CharacterSelectionMessage.java @@ -1,4 +1,7 @@ -package uulm.teamname.marvelous.gamelibrary.messages; +package uulm.teamname.marvelous.gamelibrary.messages.client; + +import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.MessageType; import java.util.Arrays; diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/HelloServerMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/HelloServerMessage.java similarity index 54% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/HelloServerMessage.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/HelloServerMessage.java index c23b085..867fcf2 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/HelloServerMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/HelloServerMessage.java @@ -1,6 +1,9 @@ -package uulm.teamname.marvelous.gamelibrary.messages; +package uulm.teamname.marvelous.gamelibrary.messages.client; -public class HelloServerMessage extends BasicMessage{ +import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.MessageType; + +public class HelloServerMessage extends BasicMessage { public final MessageType messageType = MessageType.HELLO_SERVER; diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/PlayerReadyMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/PlayerReadyMessage.java similarity index 57% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/PlayerReadyMessage.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/PlayerReadyMessage.java index 3b456f8..d1dd924 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/PlayerReadyMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/PlayerReadyMessage.java @@ -1,4 +1,8 @@ -package uulm.teamname.marvelous.gamelibrary.messages; +package uulm.teamname.marvelous.gamelibrary.messages.client; + +import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.MessageType; +import uulm.teamname.marvelous.gamelibrary.messages.RoleEnum; public class PlayerReadyMessage extends BasicMessage { diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ReconnectMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/ReconnectMessage.java similarity index 54% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ReconnectMessage.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/ReconnectMessage.java index a979577..682993c 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ReconnectMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/ReconnectMessage.java @@ -1,4 +1,7 @@ -package uulm.teamname.marvelous.gamelibrary.messages; +package uulm.teamname.marvelous.gamelibrary.messages.client; + +import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.MessageType; public class ReconnectMessage extends BasicMessage { diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/RequestMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/RequestMessage.java similarity index 90% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/RequestMessage.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/RequestMessage.java index 77146a7..a73244e 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/RequestMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/RequestMessage.java @@ -1,7 +1,9 @@ -package uulm.teamname.marvelous.gamelibrary.messages; +package uulm.teamname.marvelous.gamelibrary.messages.client; import com.fasterxml.jackson.annotation.JsonIgnore; import uulm.teamname.marvelous.gamelibrary.events.Event; +import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.MessageType; import uulm.teamname.marvelous.gamelibrary.requests.Request; import java.util.Arrays; diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ConfirmSelectionMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/ConfirmSelectionMessage.java similarity index 84% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ConfirmSelectionMessage.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/ConfirmSelectionMessage.java index c596fa6..103ec04 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ConfirmSelectionMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/ConfirmSelectionMessage.java @@ -1,4 +1,7 @@ -package uulm.teamname.marvelous.gamelibrary.messages; +package uulm.teamname.marvelous.gamelibrary.messages.server; + +import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.MessageType; import java.util.Objects; diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/EventMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/EventMessage.java similarity index 90% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/EventMessage.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/EventMessage.java index dad71f3..04878fd 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/EventMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/EventMessage.java @@ -1,7 +1,9 @@ -package uulm.teamname.marvelous.gamelibrary.messages; +package uulm.teamname.marvelous.gamelibrary.messages.server; import com.fasterxml.jackson.annotation.JsonIgnore; import uulm.teamname.marvelous.gamelibrary.events.Event; +import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.MessageType; import java.util.Arrays; import java.util.HashMap; diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/GameAssignmentMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GameAssignmentMessage.java similarity index 88% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/GameAssignmentMessage.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GameAssignmentMessage.java index 5221237..790ead4 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/GameAssignmentMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GameAssignmentMessage.java @@ -1,6 +1,8 @@ -package uulm.teamname.marvelous.gamelibrary.messages; +package uulm.teamname.marvelous.gamelibrary.messages.server; import uulm.teamname.marvelous.gamelibrary.config.CharacterProperties; +import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.MessageType; import java.util.Arrays; import java.util.Objects; diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/GameStructureMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GameStructureMessage.java similarity index 92% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/GameStructureMessage.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GameStructureMessage.java index b0c9c73..4461fd5 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/GameStructureMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GameStructureMessage.java @@ -1,4 +1,4 @@ -package uulm.teamname.marvelous.gamelibrary.messages; +package uulm.teamname.marvelous.gamelibrary.messages.server; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -6,6 +6,9 @@ import uulm.teamname.marvelous.gamelibrary.config.CharacterConfig; import uulm.teamname.marvelous.gamelibrary.config.CharacterProperties; import uulm.teamname.marvelous.gamelibrary.config.PartyConfig; import uulm.teamname.marvelous.gamelibrary.config.ScenarioConfig; +import uulm.teamname.marvelous.gamelibrary.messages.AssignmentEnum; +import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.MessageType; import java.util.Arrays; import java.util.Objects; @@ -25,7 +28,7 @@ public class GameStructureMessage extends BasicMessage { public final MessageType messageType = MessageType.GAME_STRUCTURE; /** The role the client has been assigned to */ - public Assignment assignment; + public AssignmentEnum assignment; /** The name of the first player */ public String playerOneName; diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/GeneralAssignmentMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GeneralAssignmentMessage.java similarity index 83% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/GeneralAssignmentMessage.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GeneralAssignmentMessage.java index 1a54159..0ee189d 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/GeneralAssignmentMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GeneralAssignmentMessage.java @@ -1,4 +1,7 @@ -package uulm.teamname.marvelous.gamelibrary.messages; +package uulm.teamname.marvelous.gamelibrary.messages.server; + +import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.MessageType; import java.util.Objects; diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/GoodbyeClientMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GoodbyeClientMessage.java similarity index 52% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/GoodbyeClientMessage.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GoodbyeClientMessage.java index d7b1773..e1bc143 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/GoodbyeClientMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GoodbyeClientMessage.java @@ -1,4 +1,7 @@ -package uulm.teamname.marvelous.gamelibrary.messages; +package uulm.teamname.marvelous.gamelibrary.messages.server; + +import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.MessageType; public class GoodbyeClientMessage extends BasicMessage { diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/HelloClientMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/HelloClientMessage.java similarity index 55% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/HelloClientMessage.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/HelloClientMessage.java index 2238cf2..a3ec742 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/HelloClientMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/HelloClientMessage.java @@ -1,4 +1,7 @@ -package uulm.teamname.marvelous.gamelibrary.messages; +package uulm.teamname.marvelous.gamelibrary.messages.server; + +import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.MessageType; public class HelloClientMessage extends BasicMessage { diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/requests/Request.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/requests/Request.java index 3fe5702..6818d21 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/requests/Request.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/requests/Request.java @@ -3,7 +3,7 @@ package uulm.teamname.marvelous.gamelibrary.requests; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import uulm.teamname.marvelous.gamelibrary.messages.EventMessage; +import uulm.teamname.marvelous.gamelibrary.messages.server.EventMessage; import uulm.teamname.marvelous.gamelibrary.json.ingame.deserialize.RequestDeserializer; import uulm.teamname.marvelous.gamelibrary.json.ingame.serialize.RequestSerializer; diff --git a/src/test/java/uulm/teamname/marvelous/gamelibrary/json/JSONTest.java b/src/test/java/uulm/teamname/marvelous/gamelibrary/json/JSONTest.java index c399e00..6fc0fd3 100644 --- a/src/test/java/uulm/teamname/marvelous/gamelibrary/json/JSONTest.java +++ b/src/test/java/uulm/teamname/marvelous/gamelibrary/json/JSONTest.java @@ -13,7 +13,7 @@ import uulm.teamname.marvelous.gamelibrary.entities.EntityID; 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.messages.EventMessage; +import uulm.teamname.marvelous.gamelibrary.messages.server.EventMessage; import java.util.*; diff --git a/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/deserialize/MessageDeserializationTest.java b/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/deserialize/MessageDeserializationTest.java index 7ca9fb4..0dedaa3 100644 --- a/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/deserialize/MessageDeserializationTest.java +++ b/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/deserialize/MessageDeserializationTest.java @@ -12,6 +12,8 @@ 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.messages.*; +import uulm.teamname.marvelous.gamelibrary.messages.client.*; +import uulm.teamname.marvelous.gamelibrary.messages.server.*; import uulm.teamname.marvelous.gamelibrary.requests.Request; import uulm.teamname.marvelous.gamelibrary.requests.RequestBuilder; import uulm.teamname.marvelous.gamelibrary.requests.RequestType; @@ -331,7 +333,7 @@ public class MessageDeserializationTest { var message = new GameStructureMessage(); // message.messageType = MessageType.GAME_STRUCTURE; - message.assignment = Assignment.PlayerOne; + message.assignment = AssignmentEnum.PlayerOne; message.playerOneName = "Gandalf"; message.playerTwoName = "Bilbo"; message.playerOneCharacters = new CharacterProperties[] {racoon, quicksilver, hulk}; diff --git a/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/serialize/MessageSerializationTest.java b/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/serialize/MessageSerializationTest.java index 9d1d21c..cb6e573 100644 --- a/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/serialize/MessageSerializationTest.java +++ b/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/serialize/MessageSerializationTest.java @@ -15,6 +15,8 @@ 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.messages.*; +import uulm.teamname.marvelous.gamelibrary.messages.client.*; +import uulm.teamname.marvelous.gamelibrary.messages.server.*; import uulm.teamname.marvelous.gamelibrary.requests.Request; import uulm.teamname.marvelous.gamelibrary.requests.RequestBuilder; import uulm.teamname.marvelous.gamelibrary.requests.RequestType; @@ -343,7 +345,7 @@ public class MessageSerializationTest { var message = new GameStructureMessage(); // message.messageType = MessageType.GAME_STRUCTURE; - message.assignment = Assignment.PlayerOne; + message.assignment = AssignmentEnum.PlayerOne; message.playerOneName = "Gandalf"; message.playerTwoName = "Bilbo"; message.playerOneCharacters = new CharacterProperties[] {racoon, quicksilver, hulk};