diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/json/basic/BasicMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/json/basic/BasicMessage.java new file mode 100644 index 0000000..e28dfc2 --- /dev/null +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/json/basic/BasicMessage.java @@ -0,0 +1,39 @@ +package uulm.teamname.marvelous.gamelibrary.json.basic; + +import uulm.teamname.marvelous.gamelibrary.json.MessageType; + +/** + * The basic message from the standard, containing all possible expansion keys. + * In other words, one needs to check the messageType, as fields that aren't sent + * are null. Note that ingame messages are not deserialized into the {@link BasicMessage}, but instead + * into the {@link uulm.teamname.marvelous.gamelibrary.json.ingame.MessageStructure}. + */ +public class BasicMessage { + + /** + * The user ID is (apparently) a MD5 hash made from the username and device IP. It is assigned by the server. + */ + String userID; + + /** + * The messageType describes the type of message that might be sent + */ + MessageType messageType; + + /** + * I have no idea what this might be used for, even less the boolean in the answer + */ + String optionals; + + /** + * Exists only in a HelloClient message. + * Describes whether the user was in a running game before reconnecting. + */ + boolean runningGame; + + /** + * Exists only in GameAssignment and GeneralAssignment messages. + * Used for notifying the player of which party they have been assigned to + */ + String gameID; +} diff --git a/src/test/java/uulm/teamname/marvelous/gamelibrary/TupleTest.java b/src/test/java/uulm/teamname/marvelous/gamelibrary/TupleTest.java index 4adf83e..78b8697 100644 --- a/src/test/java/uulm/teamname/marvelous/gamelibrary/TupleTest.java +++ b/src/test/java/uulm/teamname/marvelous/gamelibrary/TupleTest.java @@ -7,8 +7,8 @@ import static org.junit.jupiter.api.Assertions.*; class TupleTest { @Test void basicTest() { - Tuple a = new Tuple<>(0, 1); - assertEquals((int) a.item1, 0); - assertEquals((int) a.item2, 1); + Tuple t = new Tuple<>(0, 1); + assertEquals((int) t.item1, 0); + assertEquals((int) t.item2, 1); } }