Class LevelParser

java.lang.Object
xyz.calcugames.levelz.parser.LevelParser

public abstract class LevelParser extends Object
Represents a LevelZ level parser.
  • Constructor Details

    • LevelParser

      protected LevelParser(@NotNull @NotNull Random seed)
      Creates a new Level Parser.
      Parameters:
      seed - Seed
  • Method Details

    • getSeed

      @NotNull public final @NotNull Random getSeed()
      Gets the randomizer seed for this parser.
      Returns:
      Randomizer
    • getInputStream

      @NotNull public abstract @NotNull InputStream getInputStream()
      Gets the input stream for this parser.
      Returns:
      Input Stream
    • parse

      @NotNull public abstract @NotNull Level parse()
      Parses the level from the input stream. This will close the input stream.
      Returns:
      Level
    • builder

      @NotNull public static @NotNull LevelParser.Builder builder()
      Creates a new Level Parser Builder.
      Returns:
      Level Parser Builder
    • value

      @Nullable public static @Nullable Object value(@Nullable @Nullable String str)

      Converts a string to an object value.

      This will do the following:

      • Convert true and false to a boolean primitive
      • Attempt to convert integers into a integer primitive
      • Attempt to convert doubles into a double primitive
      • Otherwise, return the raw string
      Parameters:
      str - String to convert
      Returns:
      Object value