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 Details

  • Method Details

    • applyOnReceive

      public boolean applyOnReceive(InternalGameWorld internalWorld)
      Description copied from interface: MessageData
      Applies to the world when received
      Specified by:
      applyOnReceive in interface MessageData
      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

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • tick

      public Long tick()
      Returns the value of the tick record component.
      Returns:
      the value of the tick record component
    • score

      public HashMap<String,Long> score()
      Returns the value of the score record component.
      Returns:
      the value of the score record component
    • clientStates

      public HashMap<Long,ClientState> clientStates()
      Returns the value of the clientStates record component.
      Returns:
      the value of the clientStates record component
    • projectileStates

      public HashMap<Long,ProjectileState> projectileStates()
      Returns the value of the projectileStates record component.
      Returns:
      the value of the projectileStates record component
    • flagStates

      public HashMap<Long,FlagGameState> flagStates()
      Returns the value of the flagStates record component.
      Returns:
      the value of the flagStates record component
    • flagBaseStates

      public HashMap<Long,FlagBaseState> flagBaseStates()
      Returns the value of the flagBaseStates record component.
      Returns:
      the value of the flagBaseStates record component