feat: added (mostly redundant) Json annotations to Events and Requests
This commit is contained in:
parent
5d5f649be1
commit
445bde1105
@ -1,14 +1,20 @@
|
|||||||
package uulm.teamname.marvelous.gamelibrary.events;
|
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.IntVector2;
|
import uulm.teamname.marvelous.gamelibrary.IntVector2;
|
||||||
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
|
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
|
||||||
import uulm.teamname.marvelous.gamelibrary.entities.StoneType;
|
import uulm.teamname.marvelous.gamelibrary.entities.StoneType;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.deserialize.EventDeserializer;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.serialize.EventSerializer;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a character event for: {@link EventType#MeleeAttackEvent}, {@link EventType#RangedAttackEvent}, {@link EventType#MoveEvent}, {@link EventType#ExchangeInfinityStoneEvent}, {@link EventType#UseInfinityStoneEvent}.
|
* Represents a character event for: {@link EventType#MeleeAttackEvent}, {@link EventType#RangedAttackEvent}, {@link EventType#MoveEvent}, {@link EventType#ExchangeInfinityStoneEvent}, {@link EventType#UseInfinityStoneEvent}.
|
||||||
*/
|
*/
|
||||||
|
@JsonDeserialize(using = EventDeserializer.class)
|
||||||
|
@JsonSerialize(using = EventSerializer.class)
|
||||||
public class CharacterEvent extends Event {
|
public class CharacterEvent extends Event {
|
||||||
public EntityID originEntity = null;
|
public EntityID originEntity = null;
|
||||||
public EntityID targetEntity = null;
|
public EntityID targetEntity = null;
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
package uulm.teamname.marvelous.gamelibrary.events;
|
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.json.ingame.deserialize.EventDeserializer;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.serialize.EventSerializer;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/** Represents a custom event ({@link EventType#CustomEvent}). */
|
/** Represents a custom event ({@link EventType#CustomEvent}). */
|
||||||
|
@JsonDeserialize(using = EventDeserializer.class)
|
||||||
|
@JsonSerialize(using = EventSerializer.class)
|
||||||
public class CustomEvent extends Event {
|
public class CustomEvent extends Event {
|
||||||
public String teamIdentifier;
|
public String teamIdentifier;
|
||||||
public HashMap<String, Object> customContent;
|
public HashMap<String, Object> customContent;
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
package uulm.teamname.marvelous.gamelibrary.events;
|
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.IntVector2;
|
import uulm.teamname.marvelous.gamelibrary.IntVector2;
|
||||||
import uulm.teamname.marvelous.gamelibrary.entities.Entity;
|
import uulm.teamname.marvelous.gamelibrary.entities.Entity;
|
||||||
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
|
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.deserialize.EventDeserializer;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.serialize.EventSerializer;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/** Represents an entity event for: {@link EventType#DestroyedEntityEvent}, {@link EventType#TakenDamageEvent}, {@link EventType#ConsumedAPEvent}, {@link EventType#ConsumedMPEvent}, {@link EventType#SpawnEntityEvent}, {@link EventType#HealedEvent}. */
|
/** Represents an entity event for: {@link EventType#DestroyedEntityEvent}, {@link EventType#TakenDamageEvent}, {@link EventType#ConsumedAPEvent}, {@link EventType#ConsumedMPEvent}, {@link EventType#SpawnEntityEvent}, {@link EventType#HealedEvent}. */
|
||||||
|
@JsonDeserialize(using = EventDeserializer.class)
|
||||||
|
@JsonSerialize(using = EventSerializer.class)
|
||||||
public class EntityEvent extends Event {
|
public class EntityEvent extends Event {
|
||||||
public EntityID targetEntity = null;
|
public EntityID targetEntity = null;
|
||||||
public IntVector2 targetField = null;
|
public IntVector2 targetField = null;
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
package uulm.teamname.marvelous.gamelibrary.events;
|
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.entities.EntityID;
|
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.deserialize.EventDeserializer;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.serialize.EventSerializer;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/** Represents a game event for: {@link EventType#RoundSetupEvent}, {@link EventType#TurnEvent}, {@link EventType#WinEvent}, {@link EventType#TurnTimeoutEvent}, {@link EventType#TimeoutWarningEvent}, {@link EventType#TimeoutEvent}, {@link EventType#PauseStartEvent}, {@link EventType#PauseStopEvent}, {@link EventType#DisconnectEvent}. */
|
/** Represents a game event for: {@link EventType#RoundSetupEvent}, {@link EventType#TurnEvent}, {@link EventType#WinEvent}, {@link EventType#TurnTimeoutEvent}, {@link EventType#TimeoutWarningEvent}, {@link EventType#TimeoutEvent}, {@link EventType#PauseStartEvent}, {@link EventType#PauseStopEvent}, {@link EventType#DisconnectEvent}. */
|
||||||
|
@JsonDeserialize(using = EventDeserializer.class)
|
||||||
|
@JsonSerialize(using = EventSerializer.class)
|
||||||
public class GameEvent extends Event {
|
public class GameEvent extends Event {
|
||||||
public Integer roundCount;
|
public Integer roundCount;
|
||||||
public Integer turnCount;
|
public Integer turnCount;
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
package uulm.teamname.marvelous.gamelibrary.events;
|
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.IntVector2;
|
import uulm.teamname.marvelous.gamelibrary.IntVector2;
|
||||||
import uulm.teamname.marvelous.gamelibrary.entities.Entity;
|
import uulm.teamname.marvelous.gamelibrary.entities.Entity;
|
||||||
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
|
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.deserialize.EventDeserializer;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.serialize.EventSerializer;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/** Represents the game state event ({@link EventType#GamestateEvent}). */
|
/** Represents the game state event ({@link EventType#GamestateEvent}). */
|
||||||
|
@JsonDeserialize(using = EventDeserializer.class)
|
||||||
|
@JsonSerialize(using = EventSerializer.class)
|
||||||
public class GamestateEvent extends Event {
|
public class GamestateEvent extends Event {
|
||||||
public Entity[] entities;
|
public Entity[] entities;
|
||||||
public EntityID[] turnOrder;
|
public EntityID[] turnOrder;
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
package uulm.teamname.marvelous.gamelibrary.requests;
|
package uulm.teamname.marvelous.gamelibrary.requests;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import uulm.teamname.marvelous.gamelibrary.IntVector2;
|
import uulm.teamname.marvelous.gamelibrary.IntVector2;
|
||||||
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
|
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
|
||||||
import uulm.teamname.marvelous.gamelibrary.entities.StoneType;
|
import uulm.teamname.marvelous.gamelibrary.entities.StoneType;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.deserialize.RequestDeserializer;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.serialize.RequestSerializer;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/** Represents a character event for: {@link RequestType#MeleeAttackRequest}, {@link RequestType#RangedAttackRequest}, {@link RequestType#MoveRequest}, {@link RequestType#ExchangeInfinityStoneRequest}, {@link RequestType#UseInfinityStoneRequest}. */
|
/** Represents a character event for: {@link RequestType#MeleeAttackRequest}, {@link RequestType#RangedAttackRequest}, {@link RequestType#MoveRequest}, {@link RequestType#ExchangeInfinityStoneRequest}, {@link RequestType#UseInfinityStoneRequest}. */
|
||||||
@JsonPropertyOrder({"requestType", "originEntity", "targetEntity", "originField", "targetField", "stoneType", "value"})
|
@JsonPropertyOrder({"requestType", "originEntity", "targetEntity", "originField", "targetField", "stoneType", "value"})
|
||||||
|
@JsonDeserialize(using = RequestDeserializer.class)
|
||||||
|
@JsonSerialize(using = RequestSerializer.class)
|
||||||
public class CharacterRequest extends Request {
|
public class CharacterRequest extends Request {
|
||||||
public EntityID originEntity = null;
|
public EntityID originEntity = null;
|
||||||
public EntityID targetEntity = null;
|
public EntityID targetEntity = null;
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
package uulm.teamname.marvelous.gamelibrary.requests;
|
package uulm.teamname.marvelous.gamelibrary.requests;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.deserialize.RequestDeserializer;
|
||||||
|
import uulm.teamname.marvelous.gamelibrary.json.ingame.serialize.RequestSerializer;
|
||||||
|
|
||||||
/** Represents a game request for: {@link RequestType#DisconnectRequest}. */
|
/** Represents a game request for: {@link RequestType#DisconnectRequest}. */
|
||||||
|
@JsonDeserialize(using = RequestDeserializer.class)
|
||||||
|
@JsonSerialize(using = RequestSerializer.class)
|
||||||
public class GameRequest extends Request {}
|
public class GameRequest extends Request {}
|
||||||
|
Loading…
Reference in New Issue
Block a user