Record Class WorldRules
java.lang.Object
java.lang.Record
za.co.wethinkcode.robots.server.persistence.WorldRules
- Record Components:
repairTime- the time taken to repair a robotreloadTime- the time taken to reload a robotmineTime- the time taken to lay a minemaxShields- the maximum shields a robot may carrymaxShots- the maximum shots a robot may carry
public record WorldRules(int repairTime, int reloadTime, int mineTime, int maxShields, int maxShots)
extends Record
The timing and combat rules of a saved world.
-
Constructor Summary
ConstructorsConstructorDescriptionWorldRules(int repairTime, int reloadTime, int mineTime, int maxShields, int maxShots) Creates an instance of aWorldRulesrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic WorldRulesdefaults()The default rules used when a world does not configure any.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxShieldsrecord component.intmaxShots()Returns the value of themaxShotsrecord component.intmineTime()Returns the value of themineTimerecord component.intReturns the value of thereloadTimerecord component.intReturns the value of therepairTimerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
WorldRules
public WorldRules(int repairTime, int reloadTime, int mineTime, int maxShields, int maxShots) Creates an instance of aWorldRulesrecord class.- Parameters:
repairTime- the value for therepairTimerecord componentreloadTime- the value for thereloadTimerecord componentmineTime- the value for themineTimerecord componentmaxShields- the value for themaxShieldsrecord componentmaxShots- the value for themaxShotsrecord component
-
-
Method Details
-
defaults
The default rules used when a world does not configure any.- Returns:
- a rule set with the standard curriculum defaults
-
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. -
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. -
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 with '=='. -
repairTime
public int repairTime()Returns the value of therepairTimerecord component.- Returns:
- the value of the
repairTimerecord component
-
reloadTime
public int reloadTime()Returns the value of thereloadTimerecord component.- Returns:
- the value of the
reloadTimerecord component
-
mineTime
public int mineTime()Returns the value of themineTimerecord component.- Returns:
- the value of the
mineTimerecord component
-
maxShields
public int maxShields()Returns the value of themaxShieldsrecord component.- Returns:
- the value of the
maxShieldsrecord component
-
maxShots
public int maxShots()Returns the value of themaxShotsrecord component.- Returns:
- the value of the
maxShotsrecord component
-