Class LevelDefinition

java.lang.Object
rekit.persistence.level.LevelDefinition
All Implemented Interfaces:
Comparable<LevelDefinition>

public final class LevelDefinition extends Object implements Comparable<LevelDefinition>
This class holds all necessary information about a level.
  • Constructor Details

    • LevelDefinition

      public LevelDefinition(InputStream in, LevelType type)
      Create a new LevelDefinition by data and type.
      Parameters:
      in - the input data (e.g. from file) of the level
      type - the type of the level
    • LevelDefinition

      public LevelDefinition(InputStream in, LevelType type, long seed)
      Create a new LevelDefinition by data and type and rnd seed.
      Parameters:
      in - the input data (e.g. from file) of the level
      type - the type of the level
      seed - the random seed for the level
  • Method Details

    • getAlias

      public String getAlias(String key)
      Get alias by key.
      Parameters:
      key - the key
      Returns:
      the alias or null if not set
    • getSetting

      public String getSetting(SettingKey key)
      Get setting by key.
      Parameters:
      key - the key
      Returns:
      the setting or null if not set
    • isSettingSet

      public boolean isSettingSet(SettingKey key)
      Check whether a setting is set (== if setting is "true" or "false", return whether it is "true", otherwise return true if setting is set to a value)
      Parameters:
      key - the key
      Returns:
      true if set, false otherwise
    • getBossSetting

      public String getBossSetting(String key)
      Get boss-setting by key.
      Parameters:
      key - the key
      Returns:
      the boss-setting or null if not set
    • getType

      public LevelType getType()
      Get the type of the level.
      Returns:
      the type
    • getName

      public String getName()
      Get the name of the level. (If no name is set, this will return the ID of the level.)
      Returns:
      the name (or id)
    • getRawData

      public String getRawData()
      Get the data of the level.
      Returns:
      the data
    • getData

      public Serializable getData(DataKey key)
      Get the data of the level.
      Parameters:
      key - the key
      Returns:
      the data of the level or the default value of the DataKey if not set
    • getSeed

      public long getSeed()
      Get the seed of the level.
      Returns:
      the seed
    • amountOfStructures

      public int amountOfStructures()
      Get the amount of structures.
      Returns:
      the amount of structures
    • getStructure

      public String[][] getStructure(int idx)
      Get structure by index.
      Parameters:
      idx - the index
      Returns:
      the structure
    • compareTo

      public int compareTo(LevelDefinition o)
      Specified by:
      compareTo in interface Comparable<LevelDefinition>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object