Record Class GameConfig
java.lang.Object
java.lang.Record
dev.zwazel.internal.message.data.GameConfig
- Record Components:
tickRate
- the tick rateclientId
- my client IDmapDefinition
- 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 TankTypeteamConfigs
- the team configurations, including the team name and amount of players maxtankConfigs
- 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 Summary
ConstructorsConstructorDescriptionGameConfig
(long tickRate, long clientId, MapDefinition mapDefinition, ConnectedClientConfig[] connectedClients, HashMap<String, TeamConfig> teamConfigs, HashMap<TankType, TankConfig> tankConfigs) Creates an instance of aGameConfig
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
applyOnReceive
(InternalGameWorld internalWorld) Applies to the world when receivedlong
clientId()
Returns the value of theclientId
record component.Returns the value of theconnectedClients
record component.final boolean
Indicates whether some other object is "equal to" this one.getClientConfig
(long clientId) getClientConfig
(String clientName) getTankConfig
(TankType tankType) getTeamConfig
(String teamName) getTeamMembers
(String teamName) Gets team members.getTeamMembers
(String teamName, Long excludeClientId) Gets team members.final int
hashCode()
Returns a hash code value for this object.Returns the value of themapDefinition
record component.Returns the value of thetankConfigs
record component.Returns the value of theteamConfigs
record component.long
tickRate()
Returns the value of thetickRate
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
-
GameConfig
public GameConfig(long tickRate, long clientId, MapDefinition mapDefinition, ConnectedClientConfig[] connectedClients, HashMap<String, TeamConfig> teamConfigs, HashMap<TankType, TankConfig> tankConfigs) Creates an instance of aGameConfig
record class.- Parameters:
tickRate
- the value for thetickRate
record componentclientId
- the value for theclientId
record componentmapDefinition
- the value for themapDefinition
record componentconnectedClients
- the value for theconnectedClients
record componentteamConfigs
- the value for theteamConfigs
record componenttankConfigs
- the value for thetankConfigs
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.
-
getMyConfig
-
getClientConfig
-
getClientConfig
-
getTeamConfig
-
getMyTeamConfig
-
getTeamMembers
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
Gets team members. Can exclude a specific client from the list.- Parameters:
teamName
- the team nameexcludeClientId
- the exclude client id- Returns:
- the team members
-
getTankConfig
-
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with thecompare
method from their corresponding wrapper classes. -
tickRate
-
clientId
-
mapDefinition
Returns the value of themapDefinition
record component.- Returns:
- the value of the
mapDefinition
record component
-
connectedClients
Returns the value of theconnectedClients
record component.- Returns:
- the value of the
connectedClients
record component
-
teamConfigs
Returns the value of theteamConfigs
record component.- Returns:
- the value of the
teamConfigs
record component
-
tankConfigs
Returns the value of thetankConfigs
record component.- Returns:
- the value of the
tankConfigs
record component
-