Interface SlimeLoader


public interface SlimeLoader
SlimeLoaders are in charge of loading worlds from a data source, and also locking and deleting them.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    deleteWorld(String worldName)
    Deletes a world from the data source.
    Returns the current saved world names.
    byte[]
    readWorld(String worldName)
    Read a world's data file.
    void
    saveWorld(String worldName, byte[] serializedWorld)
    Saves the world's data file.
    boolean
    worldExists(String worldName)
    Checks whether a world exists inside the data source.
  • Method Details

    • readWorld

      byte[] readWorld(String worldName) throws UnknownWorldException, IOException
      Read a world's data file.
      Parameters:
      worldName - The name of the world.
      Returns:
      The world's data file, contained inside a byte array.
      Throws:
      UnknownWorldException - if the world cannot be found.
      IOException - if the world could not be obtained.
    • worldExists

      boolean worldExists(String worldName) throws IOException
      Checks whether a world exists inside the data source.
      Parameters:
      worldName - The name of the world.
      Returns:
      true if the world exists inside the data source, false otherwhise.
      Throws:
      IOException - if the world could not be obtained.
    • listWorlds

      List<String> listWorlds() throws IOException
      Returns the current saved world names.
      Returns:
      a list containing all the world names
      Throws:
      IOException - if the list could not be obtained
    • saveWorld

      void saveWorld(String worldName, byte[] serializedWorld) throws IOException
      Saves the world's data file. This method will also lock the world, in case it's not locked already.
      Parameters:
      worldName - The name of the world.
      serializedWorld - The world's data file, contained inside a byte array.
      Throws:
      IOException - if the world could not be saved.
    • deleteWorld

      void deleteWorld(String worldName) throws UnknownWorldException, IOException
      Deletes a world from the data source.
      Parameters:
      worldName - name of the world
      Throws:
      UnknownWorldException - if the world could not be found.
      IOException - if the world could not be deleted.