Class CreateMazeRequest

java.lang.Object
dev.despical.mazeengine.api.request.CreateMazeRequest

public final class CreateMazeRequest extends Object
Describes a new maze and the overrides applied to its selected preset.

Required values identify the maze, target origin, logical grid, and preset. Constructor overrides use direct nullable values: null means inherit the preset, except for the seed, which is generated at submission when absent. Both false and zero remain explicit values rather than absence markers.

Prefer builder(String, MazeLocation, CellSize) when only a few settings need overriding. Override accessors return Optional values so callers can distinguish inherited settings from explicitly supplied ones.

Construction validates local values only. The operation service resolves the current preset and checks permissions, world availability, and configured limits when the request is submitted. Built requests are immutable.

  • Constructor Details

    • CreateMazeRequest

      public CreateMazeRequest(MazeId id, MazeLocation origin, CellSize cells, String preset, Long seed, MazeGeometry geometry, Double complexity, Boolean roof, Boolean snapshot, CreateMazeRequest.Placement placement)
      Constructs a request using direct values for all settings.

      Null overrides inherit from the selected preset; a null seed requests a generated seed. Preset identifiers are normalized to lowercase. Palette settings are resolved from configuration when creation is submitted.

      Parameters:
      id - the unique maze identifier
      origin - the minimum corner in the target world
      cells - the grid dimensions in cells
      preset - the case-insensitive preset identifier
      seed - the explicit seed, or null to generate one at submission
      geometry - the geometry override, or null to inherit the preset
      complexity - the complexity override, or null to inherit the preset
      roof - the ceiling override, or null to inherit the preset
      snapshot - the terrain capture override, or null to inherit the preset
      placement - the occupied-block policy, or null to inherit the preset
      Throws:
      NullPointerException - if a required field or the preset is null
      IllegalArgumentException - if the preset identifier is invalid or the supplied complexity is non-finite or outside 0..1
  • Method Details

    • id

      public MazeId id()
      The normalized identifier reserved for the new maze.
      Returns:
      the unique maze identifier
    • origin

      public MazeLocation origin()
      The minimum block corner and floor layer of the maze.

      The world must be loaded when creation is submitted. Negative world coordinates are supported.

      Returns:
      the minimum corner in the target world
    • cells

      public CellSize cells()
      The logical dimensions of the generated cell graph.

      Cell counts are independent of corridor widths. Server cell and block-volume limits are checked when the request is submitted.

      Returns:
      the grid dimensions in cells
    • preset

      public String preset()
      The configured preset identifier used to resolve inherited settings.

      Identifiers are normalized to lowercase. The preset must exist when the request is submitted; constructing a request does not query configuration.

      Returns:
      the case-insensitive preset identifier
    • seed

      public OptionalLong seed()
      The explicitly supplied deterministic generation seed.

      An absent seed is generated securely at submission. Every long value, including zero and negative values, is a valid explicit seed.

      Returns:
      the explicit seed, or empty when no override is supplied
    • geometry

      public Optional<MazeGeometry> geometry()
      The complete override for corridor and wall dimensions.

      An absent value inherits all dimensions from the selected preset. Supplying a value replaces path width, wall thickness, and wall height together.

      Returns:
      the geometry override, or empty when no override is supplied
    • complexity

      public OptionalDouble complexity()
      The override used to derive generation biases.

      A supplied value must be finite and within 0..1 inclusive. Resolving this override removes the preset's advanced generation biases and derives them anew.

      Returns:
      the complexity override, or empty when no override is supplied
    • roof

      public Optional<Boolean> roof()
      The override controlling whether a ceiling is generated.

      Both true and false are explicit overrides. An absent value inherits the preset ceiling setting.

      Returns:
      the ceiling override, or empty when no override is supplied
    • snapshot

      public Optional<Boolean> snapshot()
      The override controlling original terrain capture.

      Enabling capture requires WorldEdit or FAWE when creation is submitted. An absent value inherits the preset snapshot setting.

      Returns:
      the terrain capture override, or empty when no override is supplied
    • placement

      The override controlling how occupied blocks are handled.

      The policy is used during preflight. Palette and advanced generation settings otherwise come from the selected preset.

      Returns:
      the occupied-block policy, or empty when no override is supplied
    • equals

      public boolean equals(Object other)
      Compares all captured values with another instance.

      Equality is based on contents rather than object identity, including any absent override or custom destination.

      Overrides:
      equals in class Object
      Parameters:
      other - the object to compare
      Returns:
      whether the other instance contains the same values
    • hashCode

      public int hashCode()
      Returns a hash code based on all captured values.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code corresponding to equals(Object)
    • toString

      public String toString()
      Formats the captured values for diagnostics.

      The representation is intended for logging, not as a persistence format.

      Overrides:
      toString in class Object
      Returns:
      a description containing the captured field values
    • builder

      public static CreateMazeRequest.Builder builder(String name, MazeLocation origin, CellSize cells)
      Creates a builder with the default preset and no overrides.

      The builder accepts direct values for overrides. No Optional wrappers are needed; settings not supplied to the builder inherit from the preset.

      Parameters:
      name - the case-insensitive maze name
      origin - the minimum block corner and floor layer
      cells - the logical grid dimensions
      Returns:
      a new reusable request builder
      Throws:
      IllegalArgumentException - if the maze name is invalid or reserved
      NullPointerException - if any required argument is null