Interface WorldManager
-
Method Summary
Modifier and TypeMethodDescriptioncopyWorld
(ResourceKey key, ResourceKey copyKey) Copies world data under the providedkey
to a provided key.deleteWorld
(ResourceKey key) Deletes world data under the providedkey
.Loads an offlineproperties
.loadWorld
(ResourceKey key) loadWorld
(WorldTemplate template) moveWorld
(ResourceKey key, ResourceKey moveKey) Moves world data under the providedkey
to another key.default List<ResourceKey>
saveProperties
(ServerWorldProperties properties) Saves aproperties
.server()
Gets theServer
.unloadWorld
(ResourceKey key) unloadWorld
(ServerWorld world) Unloads aworld
.world
(ResourceKey key) boolean
worldExists
(ResourceKey key) Gets if akey
exists as an actual world, offline or online.worlds()
Gets all currently loadedworlds
.worldsOfType
(WorldType type)
-
Method Details
-
server
Server server()Gets theServer
.- Returns:
- The server
-
world
- Parameters:
key
- The key- Returns:
- The world, if found
-
worldDirectory
Gets adirectory
that 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
-
worlds
Collection<ServerWorld> worlds()Gets all currently loadedworlds
.- Returns:
- The worlds
-
worldKeys
List<ResourceKey> worldKeys()Gets thekeys
of both online and offlineworlds
.It is up to the implementation to determine how offline keys are provided to the developer.
- Returns:
- The keys
-
offlineWorldKeys
Gets thekeys
of offlineworlds
.It is up to the implementation to determine how offline keys are provided to the developer.
- Returns:
- The keys
-
worldExists
Gets if akey
exists as an actual world, offline or online.- Parameters:
key
- The key- Returns:
- True if existed, false if not
-
worldKey
- Parameters:
uniqueId
- The unique id- Returns:
- The key or
Optional.empty()
if not found
-
worldsOfType
- Parameters:
type
- The type- Returns:
- The
worlds
-
loadWorld
Loads aworld
from atemplate
.If a world is already loaded by the
key
of the template, the world will be returned instead.- Parameters:
template
- The template- Returns:
- The world
-
loadWorld
Loads aworld
by akey
.If a world with the given name is already loaded then it is returned instead.
- Parameters:
key
- The key- Returns:
- The world
-
unloadWorld
Unloads aworld
by 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
-
unloadWorld
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
-
loadProperties
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
-
saveProperties
Saves aproperties
.- Parameters:
properties
- The properties- Returns:
- True if successful, false if not
-
copyWorld
Copies world data under the providedkey
to 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 keycopyKey
- The copied key for the new properties- Returns:
- The copied properties
-
moveWorld
Moves world data under the providedkey
to 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 keymoveKey
- The move key- Returns:
- True if the move was successful
-
deleteWorld
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.
-