Package com.infernalsuite.asp.api
Interface AdvancedSlimePaperAPI
public interface AdvancedSlimePaperAPI
Main class of the SWM API. From here, you can load
 worlds and add them to the server's world list.
 
All methods are allowed to be called asynchronously unless specifically stated in the javadoc
All methods are allowed to be called asynchronously unless specifically stated in the javadoc
- 
Nested Class Summary
Nested Classes - 
Method Summary
Modifier and TypeMethodDescriptioncreateEmptyWorld(String worldName, boolean readOnly, SlimePropertyMap propertyMap, @Nullable SlimeLoader loader) Creates an empty world.getLoadedWorld(String worldName) Gets a world which has already been loaded by ASWM.Gets a list of worlds which have been loaded by ASWM.Returns theSlimeSerializationAdapterused to serialize and deserialize SlimeWorlds.static AdvancedSlimePaperAPIinstance()Gets the instance of the AdvancedSlimePaper API.loadWorld(SlimeWorld world, boolean callWorldLoadEvent) Generates a Minecraft World from aSlimeWorldand adds it to the server's world list.voidmigrateWorld(String worldName, SlimeLoader currentLoader, SlimeLoader newLoader) Migrates aSlimeWorldto another datasource.readVanillaWorld(File worldDir, String worldName, @Nullable SlimeLoader loader) Reads a vanilla world and converts it to SRF.readWorld(SlimeLoader loader, String worldName, boolean readOnly, SlimePropertyMap propertyMap) Reads a world using a specifiedSlimeLoader.voidsaveWorld(SlimeWorld world) Saves aSlimeWorldinto theSlimeLoaderobtained fromSlimeWorld.getLoader()
It is suggested to use this instead ofWorld.save(), as this method will block the current thread until the world is savedbooleanworldLoaded(SlimeWorld world) Checks if aSlimeWorldis loaded on the server. 
- 
Method Details
- 
readWorld
SlimeWorld readWorld(SlimeLoader loader, String worldName, boolean readOnly, SlimePropertyMap propertyMap) throws UnknownWorldException, IOException, CorruptedWorldException, NewerFormatException Reads a world using a specifiedSlimeLoader. This world won't be loaded into the server's world list.- Parameters:
 loader-SlimeLoaderused to retrieve the world.worldName- Name of the world.readOnly- Whether read-only mode is enabled.propertyMap- ASlimePropertyMapobject containing all the properties of the world.- Returns:
 - A 
SlimeWorld, which is the in-memory representation of the world. - Throws:
 UnknownWorldException- if the world cannot be found.IOException- if the world cannot be obtained from the specified data source.CorruptedWorldException- if the world retrieved cannot be parsed into aSlimeWorldobject.NewerFormatException- if the world uses a newer version of the SRF.
 - 
getLoadedWorld
Gets a world which has already been loaded by ASWM.- Parameters:
 worldName- the name of the world to get- Returns:
 - the loaded world, or 
nullif no loaded world matches the given name 
 - 
getLoadedWorlds
List<SlimeWorldInstance> getLoadedWorlds()Gets a list of worlds which have been loaded by ASWM. Note: The returned list is immutable, and encompasses a view of the loaded worlds at the time of the method call.- Returns:
 - a list of worlds
 
 - 
loadWorld
SlimeWorldInstance loadWorld(SlimeWorld world, boolean callWorldLoadEvent) throws IllegalArgumentException Generates a Minecraft World from aSlimeWorldand adds it to the server's world list.
This method must be called in sync with the Server Thread- Parameters:
 world-SlimeWorldInstanceworld to be added to the server's world listcallWorldLoadEvent- Whether to callWorldLoadEvent- Returns:
 - Returns a slime world representing a live minecraft world
 - Throws:
 IllegalArgumentException- if the world is already loaded
 - 
worldLoaded
Checks if aSlimeWorldis loaded on the server.- Parameters:
 world- TheSlimeWorldto check.- Returns:
 trueif the world is loaded,falseotherwise.
 - 
saveWorld
Saves aSlimeWorldinto theSlimeLoaderobtained fromSlimeWorld.getLoader()
It is suggested to use this instead ofWorld.save(), as this method will block the current thread until the world is saved- Parameters:
 world- TheSlimeWorldto save.- Throws:
 IOException- if the world could not be saved.
 - 
migrateWorld
void migrateWorld(String worldName, SlimeLoader currentLoader, SlimeLoader newLoader) throws IOException, WorldAlreadyExistsException, UnknownWorldException Migrates aSlimeWorldto another datasource.- Parameters:
 worldName- The name of the world to be migrated.currentLoader- TheSlimeLoaderof the data source where the world is currently stored in.newLoader- TheSlimeLoaderof the data source where the world will be moved to.- Throws:
 IOException- if the world could not be migrated.WorldAlreadyExistsException- if a world with the same name already exists inside the new data source.UnknownWorldException- if the world has been removed from the old data source.
 - 
createEmptyWorld
SlimeWorld createEmptyWorld(String worldName, boolean readOnly, SlimePropertyMap propertyMap, @Nullable @Nullable SlimeLoader loader) Creates an empty world.
This method does not load the world, nor save it to a datasource. UseloadWorld(SlimeWorld, boolean), andsaveWorld(SlimeWorld)for that.- Parameters:
 worldName- Name of the world.readOnly- Whether read-only mode is enabled.propertyMap- ASlimePropertyMapobject containing all the properties of the world.loader- TheSlimeLoaderused to store the world when it gets loaded, ornullif the world is temporary.- Returns:
 - A 
SlimeWorld, which is the in-memory representation of the world. 
 - 
readVanillaWorld
SlimeWorld readVanillaWorld(File worldDir, String worldName, @Nullable @Nullable SlimeLoader loader) throws InvalidWorldException, WorldLoadedException, WorldTooBigException, IOException, WorldAlreadyExistsException Reads a vanilla world and converts it to SRF.
This method does not load the world, nor save it to a datasource. UseloadWorld(SlimeWorld, boolean), andsaveWorld(SlimeWorld)for that.- Parameters:
 worldDir- The directory where the world is.worldName- The name of the world.loader- TheSlimeLoaderused to store the world when it gets loaded, ornullif the world is temporary.- Returns:
 - SlimeWorld to import
 - Throws:
 InvalidWorldException- if the provided directory does not contain a valid world.WorldLoadedException- if the world is loaded on the server.WorldTooBigException- if the world is too big to be imported into the SRF.IOException- if the world could not be read or stored.WorldAlreadyExistsException
 - 
getSerializer
Returns theSlimeSerializationAdapterused to serialize and deserialize SlimeWorlds. Manual de-/serialization is considered experimental and may change in future versions.Please use SlimeLoaders where possible
- Returns:
 - A adapter for serializing and deserializing SlimeWorlds
 
 - 
instance
Gets the instance of the AdvancedSlimePaper API.- Returns:
 - the instance of the AdvancedSlimePaper API
 
 
 -