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 robot
reloadTime - the time taken to reload a robot
mineTime - the time taken to lay a mine
maxShields - the maximum shields a robot may carry
maxShots - 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

    Constructors
    Constructor
    Description
    WorldRules(int repairTime, int reloadTime, int mineTime, int maxShields, int maxShots)
    Creates an instance of a WorldRules record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static WorldRules
    The default rules used when a world does not configure any.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the maxShields record component.
    int
    Returns the value of the maxShots record component.
    int
    Returns the value of the mineTime record component.
    int
    Returns the value of the reloadTime record component.
    int
    Returns the value of the repairTime record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • WorldRules

      public WorldRules(int repairTime, int reloadTime, int mineTime, int maxShields, int maxShots)
      Creates an instance of a WorldRules record class.
      Parameters:
      repairTime - the value for the repairTime record component
      reloadTime - the value for the reloadTime record component
      mineTime - the value for the mineTime record component
      maxShields - the value for the maxShields record component
      maxShots - the value for the maxShots record component
  • Method Details

    • defaults

      public static WorldRules defaults()
      The default rules used when a world does not configure any.
      Returns:
      a rule set with the standard curriculum defaults
    • 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 '=='.
      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.
    • repairTime

      public int repairTime()
      Returns the value of the repairTime record component.
      Returns:
      the value of the repairTime record component
    • reloadTime

      public int reloadTime()
      Returns the value of the reloadTime record component.
      Returns:
      the value of the reloadTime record component
    • mineTime

      public int mineTime()
      Returns the value of the mineTime record component.
      Returns:
      the value of the mineTime record component
    • maxShields

      public int maxShields()
      Returns the value of the maxShields record component.
      Returns:
      the value of the maxShields record component
    • maxShots

      public int maxShots()
      Returns the value of the maxShots record component.
      Returns:
      the value of the maxShots record component