Class DimensionTypeManager

java.lang.Object
net.minestom.server.world.DimensionTypeManager

public final class DimensionTypeManager extends Object
Allows servers to register custom dimensions. Also used during player login to send the list of all existing dimensions.

Contains DimensionType.OVERWORLD by default but can be removed.

  • Constructor Details

    • DimensionTypeManager

      public DimensionTypeManager()
  • Method Details

    • addDimension

      public void addDimension(@NotNull @NotNull DimensionType dimensionType)
      Adds a new dimension type. This does NOT send the new list to players.
      Parameters:
      dimensionType - the dimension to add
    • removeDimension

      public boolean removeDimension(@NotNull @NotNull DimensionType dimensionType)
      Removes a dimension type. This does NOT send the new list to players.
      Parameters:
      dimensionType - the dimension to remove
      Returns:
      if the dimension type was removed, false if it was not present before
    • isRegistered

      public boolean isRegistered(@NotNull @NotNull NamespaceID namespaceID)
      Parameters:
      namespaceID - The dimension name
      Returns:
      true if the dimension is registered
    • isRegistered

      public boolean isRegistered(@Nullable @Nullable DimensionType dimensionType)
      Parameters:
      dimensionType - dimension to check if is registered
      Returns:
      true if the dimension is registered
    • getDimension

      @Nullable public @Nullable DimensionType getDimension(@NotNull @NotNull NamespaceID namespaceID)
      Return to a @DimensionType only if present and registered
      Parameters:
      namespaceID - The Dimension Name
      Returns:
      a DimensionType if it is present and registered
    • unmodifiableList

      @NotNull public @NotNull List<DimensionType> unmodifiableList()
      Returns an immutable copy of the dimension types already registered.
      Returns:
      an unmodifiable List containing all the added dimensions
    • toNBT

      @NotNull public @NotNull org.jglrxavpok.hephaistos.nbt.NBTCompound toNBT()
      Creates the NBTCompound containing all the registered dimensions.

      Used when a player connects.

      Returns:
      an nbt compound containing the registered dimensions