Record Class GameState
java.lang.Object
java.lang.Record
dev.zwazel.internal.message.data.GameState
- Record Components:
tick
- The tick at which this state was recorded.score
- The score of each team.clientStates
- The state of each client.projectileStates
- The state of each projectile.flagStates
- The state of each flag.flagBaseStates
- The state of each flag base.
- All Implemented Interfaces:
MessageData
public record GameState(Long tick, HashMap<String,Long> score, HashMap<Long,ClientState> clientStates, HashMap<Long,ProjectileState> projectileStates, HashMap<Long,FlagGameState> flagStates, HashMap<Long,FlagBaseState> flagBaseStates)
extends Record
implements MessageData
Represents the state of the game at a given tick.
-
Constructor Summary
ConstructorsConstructorDescriptionGameState
(Long tick, HashMap<String, Long> score, HashMap<Long, ClientState> clientStates, HashMap<Long, ProjectileState> projectileStates, HashMap<Long, FlagGameState> flagStates, HashMap<Long, FlagBaseState> flagBaseStates) Creates an instance of aGameState
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
applyOnReceive
(InternalGameWorld internalWorld) Applies to the world when receivedReturns the value of theclientStates
record component.final boolean
Indicates whether some other object is "equal to" this one.Returns the value of theflagBaseStates
record component.Returns the value of theflagStates
record component.final int
hashCode()
Returns a hash code value for this object.Returns the value of theprojectileStates
record component.score()
Returns the value of thescore
record component.tick()
Returns the value of thetick
record component.final String
toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface dev.zwazel.internal.message.MessageData
applyBeforeSend, applyOnAddingToQueue, isUnique
-
Constructor Details
-
GameState
public GameState(Long tick, HashMap<String, Long> score, HashMap<Long, ClientState> clientStates, HashMap<Long, ProjectileState> projectileStates, HashMap<Long, FlagGameState> flagStates, HashMap<Long, FlagBaseState> flagBaseStates) Creates an instance of aGameState
record class.- Parameters:
tick
- the value for thetick
record componentscore
- the value for thescore
record componentclientStates
- the value for theclientStates
record componentprojectileStates
- the value for theprojectileStates
record componentflagStates
- the value for theflagStates
record componentflagBaseStates
- the value for theflagBaseStates
record component
-
-
Method Details
-
applyOnReceive
Description copied from interface:MessageData
Applies to the world when received- Specified by:
applyOnReceive
in interfaceMessageData
- Parameters:
internalWorld
- the world- Returns:
- if true, we add it to the Input Queue, so Bots can read them. If false, we don't.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
tick
-
score
-
clientStates
Returns the value of theclientStates
record component.- Returns:
- the value of the
clientStates
record component
-
projectileStates
Returns the value of theprojectileStates
record component.- Returns:
- the value of the
projectileStates
record component
-
flagStates
Returns the value of theflagStates
record component.- Returns:
- the value of the
flagStates
record component
-
flagBaseStates
Returns the value of theflagBaseStates
record component.- Returns:
- the value of the
flagBaseStates
record component
-