Record Class GameConfig

java.lang.Object
java.lang.Record
dev.zwazel.internal.message.data.GameConfig
Record Components:
tickRate - the tick rate
clientId - my client ID
mapDefinition - the map definition, including the map configuration with all markers, like spawn points, flags, etc.
connectedClients - the connected clients, including their client ID, name, team, and TankType
teamConfigs - the team configurations, including the team name and amount of players max
tankConfigs - the tank configurations, including the tank type, speed, health, etc.
All Implemented Interfaces:
MessageData

public record GameConfig(long tickRate, long clientId, MapDefinition mapDefinition, ConnectedClientConfig[] connectedClients, HashMap<String,TeamConfig> teamConfigs, HashMap<TankType,TankConfig> tankConfigs) extends Record implements MessageData
Represents the configuration of the game. Received when the game starts. Contains information about the game, the map, the clients, the teams, and the tanks.
  • 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.
    • getMyConfig

      public ConnectedClientConfig getMyConfig()
    • getClientConfig

      public Optional<ConnectedClientConfig> getClientConfig(String clientName)
    • getClientConfig

      public Optional<ConnectedClientConfig> getClientConfig(long clientId)
    • getTeamConfig

      public Optional<TeamConfig> getTeamConfig(String teamName)
    • getMyTeamConfig

      public TeamConfig getMyTeamConfig()
    • getTeamMembers

      public List<ConnectedClientConfig> getTeamMembers(String teamName)
      Gets team members. Can include the client itself, if it is part of the team.
      Parameters:
      teamName - the team name
      Returns:
      the team members
    • getTeamMembers

      public List<ConnectedClientConfig> getTeamMembers(String teamName, Long excludeClientId)
      Gets team members. Can exclude a specific client from the list.
      Parameters:
      teamName - the team name
      excludeClientId - the exclude client id
      Returns:
      the team members
    • getTankConfig

      public Optional<TankConfig> getTankConfig(TankType tankType)
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • tickRate

      public long tickRate()
      Returns the value of the tickRate record component.
      Returns:
      the value of the tickRate record component
    • clientId

      public long clientId()
      Returns the value of the clientId record component.
      Returns:
      the value of the clientId record component
    • mapDefinition

      public MapDefinition mapDefinition()
      Returns the value of the mapDefinition record component.
      Returns:
      the value of the mapDefinition record component
    • connectedClients

      public ConnectedClientConfig[] connectedClients()
      Returns the value of the connectedClients record component.
      Returns:
      the value of the connectedClients record component
    • teamConfigs

      public HashMap<String,TeamConfig> teamConfigs()
      Returns the value of the teamConfigs record component.
      Returns:
      the value of the teamConfigs record component
    • tankConfigs

      public HashMap<TankType,TankConfig> tankConfigs()
      Returns the value of the tankConfigs record component.
      Returns:
      the value of the tankConfigs record component