Record Class MazeRecord

java.lang.Object
java.lang.Record
dev.despical.mazeengine.storage.MazeRecord

public record MazeRecord(String name, UUID worldId, String worldName, UUID owner, Bounds bounds, long seed, Preset preset, MazeLayout layout, MazeRecord.Status status, boolean hasSnapshot, Instant created, String error, TeleportPoint teleportPoint) extends Record
Retains the saved state needed to manage and reconstruct one maze.

The record combines persistent identity, owner, world and bounds, generation seed, frozen preset, graph, lifecycle status, snapshot flag, creation time, failure text, and an optional custom teleport point. It describes a saved maze rather than a mutable live Bukkit world.

State changes create replacement records. Regeneration retains the original terrain snapshot, creation timestamp, and custom destination while replacing the seed and graph. MazeRepository persists the record, and the service publishes replacements as operations progress.

  • Constructor Details

    • MazeRecord

      public MazeRecord(String name, UUID worldId, String worldName, UUID owner, Bounds bounds, long seed, Preset preset, MazeLayout layout, MazeRecord.Status status, boolean hasSnapshot, Instant created, String error)
    • MazeRecord

      public MazeRecord(String name, UUID worldId, String worldName, UUID owner, Bounds bounds, long seed, Preset preset, MazeLayout layout, MazeRecord.Status status, boolean hasSnapshot, Instant created, String error, TeleportPoint teleportPoint)
      Creates an instance of a MazeRecord record class.
      Parameters:
      name - the value for the name record component
      worldId - the value for the worldId record component
      worldName - the value for the worldName record component
      owner - the value for the owner record component
      bounds - the value for the bounds record component
      seed - the value for the seed record component
      preset - the value for the preset record component
      layout - the value for the layout record component
      status - the value for the status record component
      hasSnapshot - the value for the hasSnapshot record component
      created - the value for the created record component
      error - the value for the error record component
      teleportPoint - the value for the teleportPoint record component
  • Method Details

    • state

      public MazeRecord state(MazeRecord.Status status, boolean snapshot, String error)
    • regenerate

      public MazeRecord regenerate(long newSeed, MazeLayout newLayout)
    • withTeleportPoint

      public MazeRecord withTeleportPoint(TeleportPoint point)
    • 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.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • worldId

      public UUID worldId()
      Returns the value of the worldId record component.
      Returns:
      the value of the worldId record component
    • worldName

      public String worldName()
      Returns the value of the worldName record component.
      Returns:
      the value of the worldName record component
    • owner

      public UUID owner()
      Returns the value of the owner record component.
      Returns:
      the value of the owner record component
    • bounds

      public Bounds bounds()
      Returns the value of the bounds record component.
      Returns:
      the value of the bounds record component
    • seed

      public long seed()
      Returns the value of the seed record component.
      Returns:
      the value of the seed record component
    • preset

      public Preset preset()
      Returns the value of the preset record component.
      Returns:
      the value of the preset record component
    • layout

      public MazeLayout layout()
      Returns the value of the layout record component.
      Returns:
      the value of the layout record component
    • status

      public MazeRecord.Status status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • hasSnapshot

      public boolean hasSnapshot()
      Returns the value of the hasSnapshot record component.
      Returns:
      the value of the hasSnapshot record component
    • created

      public Instant created()
      Returns the value of the created record component.
      Returns:
      the value of the created record component
    • error

      public String error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component
    • teleportPoint

      public TeleportPoint teleportPoint()
      Returns the value of the teleportPoint record component.
      Returns:
      the value of the teleportPoint record component