Interface WorldManager
- 
 public interface WorldManager
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Boolean>copyWorld(ResourceKey key, ResourceKey copyKey)Copies world data under the providedkeyto a provided key.ServerWorlddefaultWorld()Deprecated.Useworld(ResourceKey)withDefaultWorldKeys.DEFAULTinsteadjava.util.concurrent.CompletableFuture<java.lang.Boolean>deleteWorld(ResourceKey key)Deletes world data under the providedkey.java.util.concurrent.CompletableFuture<java.util.Optional<ServerWorldProperties>>loadProperties(ResourceKey key)Loads an offlineproperties.java.util.concurrent.CompletableFuture<java.util.Optional<WorldTemplate>>loadTemplate(ResourceKey key)java.util.concurrent.CompletableFuture<ServerWorld>loadWorld(ResourceKey key)java.util.concurrent.CompletableFuture<ServerWorld>loadWorld(WorldTemplate template)java.util.concurrent.CompletableFuture<java.lang.Boolean>moveWorld(ResourceKey key, ResourceKey moveKey)Moves world data under the providedkeyto another key.default java.util.List<ResourceKey>offlineWorldKeys()java.util.concurrent.CompletableFuture<java.lang.Boolean>saveProperties(ServerWorldProperties properties)Saves aproperties.java.util.concurrent.CompletableFuture<java.lang.Boolean>saveTemplate(WorldTemplate template)Saves atemplate.Serverserver()Gets theServer.booleantemplateExists(ResourceKey key)java.util.List<ResourceKey>templateKeys()java.util.concurrent.CompletableFuture<java.lang.Boolean>unloadWorld(ResourceKey key)java.util.concurrent.CompletableFuture<java.lang.Boolean>unloadWorld(ServerWorld world)Unloads aworld.java.util.Optional<ServerWorld>world(ResourceKey key)java.util.Optional<java.nio.file.Path>worldDirectory(ResourceKey key)Gets adirectorythat exists for the providedworld key.booleanworldExists(ResourceKey key)Gets if akeyexists as an actual world, offline or online.java.util.Optional<ResourceKey>worldKey(java.util.UUID uniqueId)Gets akeybyunique id.java.util.List<ResourceKey>worldKeys()java.util.Collection<ServerWorld>worlds()Gets all currently loadedworlds.java.util.Collection<ServerWorld>worldsOfType(WorldType type)
 
- 
- 
- 
Method Detail- 
worldjava.util.Optional<ServerWorld> world(ResourceKey key) - Parameters:
- key- The key
- Returns:
- The world, if found
 
 - 
worldDirectoryjava.util.Optional<java.nio.file.Path> worldDirectory(ResourceKey key) Gets adirectorythat exists for the providedworld key.It is not required for the implementation to validate that the directory contains a proper world, only that the directory exists. - Parameters:
- key- The key
- Returns:
- The directory or Optional.empty()if not found
 
 - 
defaultWorld@Deprecated ServerWorld defaultWorld() Deprecated.Useworld(ResourceKey)withDefaultWorldKeys.DEFAULTinsteadGets thedefault world.If the default world isn't loaded, an IllegalStateExceptionwill be thrown as this means the manager is not loaded yet.It is up to the implementation to define what the default world actually is. - Returns:
- The default world
 
 - 
worldsjava.util.Collection<ServerWorld> worlds() Gets all currently loadedworlds.- Returns:
- The worlds
 
 - 
worldKeysjava.util.List<ResourceKey> worldKeys() Gets thekeysof both online and offlineworlds.It is up to the implementation to determine how offline keys are provided to the developer. - Returns:
- The keys
 
 - 
templateKeysjava.util.List<ResourceKey> templateKeys() Gets thekeysoftemplates.It is up to the implementation to determine how template keys are provided to the developer. - Returns:
- The keys
 
 - 
offlineWorldKeysdefault java.util.List<ResourceKey> offlineWorldKeys() Gets thekeysof offlineworlds.It is up to the implementation to determine how offline keys are provided to the developer. - Returns:
- The keys
 
 - 
worldExistsboolean worldExists(ResourceKey key) Gets if akeyexists as an actual world, offline or online.- Parameters:
- key- The key
- Returns:
- True if existed, false if not
 
 - 
worldKeyjava.util.Optional<ResourceKey> worldKey(java.util.UUID uniqueId) Gets akeybyunique id.- Parameters:
- uniqueId- The unique id
- Returns:
- The key or Optional.empty()if not found
 
 - 
worldsOfTypejava.util.Collection<ServerWorld> worldsOfType(WorldType type) - Parameters:
- type- The type
- Returns:
- The worlds
 
 - 
loadWorldjava.util.concurrent.CompletableFuture<ServerWorld> loadWorld(WorldTemplate template) Loads aworldfrom atemplate.If a world is already loaded by the keyof the template, the world will be returned instead.- Parameters:
- template- The template
- Returns:
- The world
 
 - 
loadWorldjava.util.concurrent.CompletableFuture<ServerWorld> loadWorld(ResourceKey key) Loads aworldby akey.If a world with the given name is already loaded then it is returned instead. - Parameters:
- key- The key
- Returns:
- The world
 
 - 
unloadWorldjava.util.concurrent.CompletableFuture<java.lang.Boolean> unloadWorld(ResourceKey key) Unloads aworldby akey.The default Minecraft world cannot be unloaded. Additional conditions for how and when a world may be unloaded are left up to the implementation to define. - Parameters:
- key- The key to unload
- Returns:
- Whether the operation was successful
 
 - 
unloadWorldjava.util.concurrent.CompletableFuture<java.lang.Boolean> unloadWorld(ServerWorld world) Unloads aworld.The default Minecraft world cannot be unloaded. Additional conditions for how and when a world may be unloaded are left up to the implementation to define. - Parameters:
- world- The world to unload
- Returns:
- Whether the operation was successful
 
 - 
templateExistsboolean templateExists(ResourceKey key) - Parameters:
- key- The key
- Returns:
- True if it exists, false if not
 
 - 
loadTemplatejava.util.concurrent.CompletableFuture<java.util.Optional<WorldTemplate>> loadTemplate(ResourceKey key) - Parameters:
- key- The key
- Returns:
- The template or Optional.empty()if not found
 
 - 
saveTemplatejava.util.concurrent.CompletableFuture<java.lang.Boolean> saveTemplate(WorldTemplate template) Saves atemplate.It is left up to the implementation on how exactly templates are saved, if at all. - Parameters:
- template- The template
- Returns:
- Whether the operation was successful
 
 - 
loadPropertiesjava.util.concurrent.CompletableFuture<java.util.Optional<ServerWorldProperties>> loadProperties(ResourceKey key) Loads an offlineproperties.It is left up to the implementation on what conditions cause a failure of loading properties. - Parameters:
- key- The key
- Returns:
- The properties
 
 - 
savePropertiesjava.util.concurrent.CompletableFuture<java.lang.Boolean> saveProperties(ServerWorldProperties properties) Saves aproperties.- Parameters:
- properties- The properties
- Returns:
- True if successful, false if not
 
 - 
copyWorldjava.util.concurrent.CompletableFuture<java.lang.Boolean> copyWorld(ResourceKey key, ResourceKey copyKey) Copies world data under the providedkeyto a provided key.If the world is loaded, the following will occur: - World is saved
- World saving is disabled
- World is copied
- World saving is enabled
 It is left up to the implementation on exactly what is copied. - Parameters:
- key- The key
- copyKey- The copied key for the new properties
- Returns:
- The copied properties
 
 - 
moveWorldjava.util.concurrent.CompletableFuture<java.lang.Boolean> moveWorld(ResourceKey key, ResourceKey moveKey) Moves world data under the providedkeyto another key.If the world is loaded, the following will occur: - World is saved
- World is unloaded
- World is moved
 The default Minecraft world cannot be moved. Additionally, it is left up to the implementation on exactly what is moved. - Parameters:
- key- The key
- moveKey- The move key
- Returns:
- True if the move was successful
 
 - 
deleteWorldjava.util.concurrent.CompletableFuture<java.lang.Boolean> deleteWorld(ResourceKey key) Deletes world data under the providedkey.If the world is loaded, the following will occur: - World is unloaded
- World is deleted
 The default Minecraft world cannot be deleted. Additionally, it is left up to the implementation on exactly what is deleted. - Parameters:
- key- The key
- Returns:
- True if the deletion was successful.
 
 
- 
 
-