Class WorldSpec

java.lang.Object
fr.fidorial.world.WorldSpec

public final class WorldSpec extends Object
An immutable description of a world to create through Server.createWorld(WorldSpec).

Instances are obtained from builder(Key); toBuilder() derives a modified copy.

Since:
0.1.0
  • Method Details

    • builder

      @Contract(value="_ -> new", pure=true) public static WorldSpec.Builder builder(Key key)
      Creates a new builder for a world identified by the given key.
      Parameters:
      key - the namespaced identifier of the world to create; also used as its world key
      Returns:
      a fresh builder
      Since:
      0.1.0
    • key

      @Contract(pure=true) public Key key()
      Returns the namespaced identifier of the world.

      This is the value that will be exposed as Keyed.key() once the world exists and the value used to look the world up again through Server.world(Key).

      Returns:
      the world key
      Since:
      0.1.0
    • seed

      @Contract(pure=true) public long seed()
      Returns the world seed.
      Returns:
      the world seed, or 0 when none was set
      Since:
      0.1.0
    • generator

      @Contract(pure=true) public Optional<WorldGenerator> generator()
      Returns the custom chunk generator for the world, if one was supplied.

      When empty, the server falls back to its built-in default generator.

      Returns:
      the generator, or an empty optional to use the server default
      Since:
      0.1.0
    • toBuilder

      @Contract(value="-> new", pure=true) public WorldSpec.Builder toBuilder()
      Returns a builder pre-populated with the values of this spec, so a modified copy can be derived without mutating the original.
      Returns:
      a builder seeded with this spec's values
      Since:
      0.1.0
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object