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 TypeMethodDescriptionvoid
acquireLock
(String worldName) Attempts to lock the world.void
deleteWorld
(String worldName) Deletes a world from the data source.boolean
isWorldLocked
(String worldName) Checks whether or not a world is locked.Returns the current saved world names.byte[]
Load a world's data file.void
Saves the world's data file.void
unlockWorld
(String worldName) Attempts to unlock the world.boolean
worldExists
(String worldName) Checks whether or not a world exists inside the data source.
-
Method Details
-
loadWorld
Load 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
Checks whether or not 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
Returns the current saved world names.- Returns:
- a list containing all the world names
- Throws:
IOException
- if the list could not be obtained
-
saveWorld
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
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.
-
acquireLock
Attempts to lock the world.- Parameters:
worldName
- name of the world- Throws:
UnknownWorldException
- If the world could not be foundWorldLockedException
- If the world is already lockedIOException
- If the world could not be locked
-
isWorldLocked
Checks whether or not a world is locked.- Parameters:
worldName
- The name of the world.- Returns:
true
if the world is locked,false
otherwhise.- Throws:
UnknownWorldException
- if the world could not be found.IOException
- if the world could not be obtained.
-
unlockWorld
Attempts to unlock the world.- Parameters:
worldName
- name of the world- Throws:
UnknownWorldException
- If the world could not be foundIOException
- If the world could not be unlocked
-