Interface MVWorldManager
-
- All Known Implementing Classes:
WorldManager
public interface MVWorldManager
Multiverse 2 World Manager APIThis API contains all of the world managing functions that your heart desires!
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description boolean
addWorld(java.lang.String name, org.bukkit.World.Environment env, java.lang.String seedString, org.bukkit.WorldType type, java.lang.Boolean generateStructures, java.lang.String generator)
Add a new World to the Multiverse Setup.boolean
addWorld(java.lang.String name, org.bukkit.World.Environment env, java.lang.String seedString, org.bukkit.WorldType type, java.lang.Boolean generateStructures, java.lang.String generator, boolean useSpawnAdjust)
Add a new World to the Multiverse Setup.boolean
cloneWorld(java.lang.String oldName, java.lang.String newName)
Make a copy of a world.boolean
cloneWorld(java.lang.String oldName, java.lang.String newName, java.lang.String generator)
Deprecated.UsecloneWorld(String, String)
instead.boolean
deleteWorld(java.lang.String name)
Remove the world from the Multiverse list, from the config and deletes the folder.boolean
deleteWorld(java.lang.String name, boolean removeConfig)
Remove the world from the Multiverse list, from the config if wanted, and deletes the folder.boolean
deleteWorld(java.lang.String name, boolean removeFromConfig, boolean deleteWorldFolder)
org.bukkit.generator.ChunkGenerator
getChunkGenerator(java.lang.String generator, java.lang.String generatorID, java.lang.String worldName)
Test if a given chunk generator is valid.void
getDefaultWorldGenerators()
This method populates an internal list and needs to be called after multiverse initialization.MultiverseWorld
getFirstSpawnWorld()
Gets the world players should spawn in first.MultiverseWorld
getMVWorld(java.lang.String name)
Returns aMultiverseWorld
if it exists, and null if it does not.MultiverseWorld
getMVWorld(java.lang.String name, boolean checkAliases)
Returns aMultiverseWorld
if the world with name given exists, and null if it does not.MultiverseWorld
getMVWorld(org.bukkit.World world)
Returns aMultiverseWorld
if it exists, and null if it does not.java.util.Collection<MultiverseWorld>
getMVWorlds()
Returns a list of all the worlds Multiverse knows about.java.util.Collection<java.lang.String>
getPotentialWorlds()
Get all the possible worlds that Multiverse has detected to be importable.MultiverseWorld
getSpawnWorld()
Gets the world players will spawn in on first join.WorldPurger
getTheWorldPurger()
Gets theWorldPurger
.java.util.List<java.lang.String>
getUnloadedWorlds()
Gets the list of worlds in the config, but unloaded.PurgeWorlds
getWorldPurger()
Deprecated.PurgeWorlds
is deprecated!boolean
hasUnloadedWorld(java.lang.String name, boolean includeLoaded)
Checks whether Multiverse knows about a provided unloaded world.boolean
isKeepingSpawnInMemory(org.bukkit.World world)
boolean
isMVWorld(java.lang.String name)
Checks to see if the given name is a validMultiverseWorld
Searches based on world name AND alias.boolean
isMVWorld(java.lang.String name, boolean checkAliases)
Checks to see if the given name is a validMultiverseWorld
.boolean
isMVWorld(org.bukkit.World world)
Checks to see if the given world is a validMultiverseWorld
.void
loadDefaultWorlds()
Loads the Worlds & Settings for any worlds that bukkit loaded before us.boolean
loadWorld(java.lang.String name)
Loads the world.org.bukkit.configuration.file.FileConfiguration
loadWorldConfig(java.io.File file)
Load the config from a file.void
loadWorlds(boolean forceLoad)
Load the Worlds & Settings from the configuration file.boolean
regenWorld(java.lang.String name, boolean useNewSeed, boolean randomSeed, java.lang.String seed)
Regenerates a world.boolean
regenWorld(java.lang.String name, boolean useNewSeed, boolean randomSeed, java.lang.String seed, boolean keepGameRules)
Regenerates a world.void
removePlayersFromWorld(java.lang.String name)
Removes all players from the specified world.boolean
removeWorldFromConfig(java.lang.String name)
Remove the world from the Multiverse list and from the config.boolean
saveWorldsConfig()
Saves the world config to disk.void
setFirstSpawnWorld(java.lang.String world)
Sets the initial spawn world for new players.boolean
unloadWorld(java.lang.String name)
Unload a world from Multiverse.boolean
unloadWorld(java.lang.String name, boolean unloadBukkit)
Unload a world from Multiverse with option to prevent calling unloadWorld in Bukkit.
-
-
-
Method Detail
-
addWorld
boolean addWorld(java.lang.String name, org.bukkit.World.Environment env, java.lang.String seedString, org.bukkit.WorldType type, java.lang.Boolean generateStructures, java.lang.String generator)
Add a new World to the Multiverse Setup.- Parameters:
name
- World Nameenv
- Environment TypeseedString
- The seed in the form of a string. If the seed is a Long, it will be interpreted as such.type
- The Type of the world to be made.generateStructures
- If true, this world will get NPC villages.generator
- The Custom generator plugin to use.- Returns:
- True if the world is added, false if not.
-
addWorld
boolean addWorld(java.lang.String name, org.bukkit.World.Environment env, java.lang.String seedString, org.bukkit.WorldType type, java.lang.Boolean generateStructures, java.lang.String generator, boolean useSpawnAdjust)
Add a new World to the Multiverse Setup.- Parameters:
name
- World Nameenv
- Environment TypeseedString
- The seed in the form of a string. If the seed is a Long, it will be interpreted as such.type
- The Type of the world to be made.generateStructures
- If true, this world will get NPC villages.generator
- The Custom generator plugin to use.useSpawnAdjust
- If true, multiverse will search for a safe spawn. If not, It will not modify the level.dat.- Returns:
- True if the world is added, false if not.
-
cloneWorld
@Deprecated boolean cloneWorld(java.lang.String oldName, java.lang.String newName, java.lang.String generator)
Deprecated.UsecloneWorld(String, String)
instead.Make a copy of a world.- Parameters:
oldName
- Name of world to be copiednewName
- Name of world to be createdgenerator
- The Custom generator plugin to use. Ignored.- Returns:
- True if the world is copied successfully, false if not.
-
cloneWorld
boolean cloneWorld(java.lang.String oldName, java.lang.String newName)
Make a copy of a world.- Parameters:
oldName
- Name of world to be copiednewName
- Name of world to be created- Returns:
- True if the world is copied successfully, false if not.
-
deleteWorld
boolean deleteWorld(java.lang.String name)
Remove the world from the Multiverse list, from the config and deletes the folder.- Parameters:
name
- The name of the world to remove- Returns:
- True if success, false if failure.
-
deleteWorld
boolean deleteWorld(java.lang.String name, boolean removeConfig)
Remove the world from the Multiverse list, from the config if wanted, and deletes the folder.- Parameters:
name
- The name of the world to removeremoveConfig
- If true(default), we'll remove the entries from the config. If false, they'll stay and the world may come back.- Returns:
- True if success, false if failure.
-
deleteWorld
boolean deleteWorld(java.lang.String name, boolean removeFromConfig, boolean deleteWorldFolder)
- Parameters:
name
- The name of the world to removeremoveFromConfig
- If true(default), we'll remove the entries from the config. If false, they'll stay and the world may come back.deleteWorldFolder
- If true the world folder will be completely deleted. If false only the contents of the world folder will be deleted- Returns:
- True if success, false if failure.
-
unloadWorld
boolean unloadWorld(java.lang.String name)
Unload a world from Multiverse.- Parameters:
name
- Name of the world to unload- Returns:
- True if the world was unloaded, false if not.
-
unloadWorld
boolean unloadWorld(java.lang.String name, boolean unloadBukkit)
Unload a world from Multiverse with option to prevent calling unloadWorld in Bukkit.- Parameters:
name
- Name of the world to unloadunloadBukkit
- True if Bukkit world should be unloaded- Returns:
- True if the world was unloaded, false if not.
-
loadWorld
boolean loadWorld(java.lang.String name)
Loads the world. Only use this if the world has been unloaded withunloadWorld(String)
.- Parameters:
name
- The name of the world to load- Returns:
- True if success, false if failure.
-
removePlayersFromWorld
void removePlayersFromWorld(java.lang.String name)
Removes all players from the specified world.- Parameters:
name
- World to remove players from.
-
getChunkGenerator
org.bukkit.generator.ChunkGenerator getChunkGenerator(java.lang.String generator, java.lang.String generatorID, java.lang.String worldName)
Test if a given chunk generator is valid.- Parameters:
generator
- The generator name.generatorID
- The generator id.worldName
- The worldName to use as the default.- Returns:
- A
ChunkGenerator
or null
-
getMVWorlds
java.util.Collection<MultiverseWorld> getMVWorlds()
Returns a list of all the worlds Multiverse knows about.- Returns:
- A list of
MultiverseWorld
.
-
getMVWorld
MultiverseWorld getMVWorld(java.lang.String name)
Returns aMultiverseWorld
if it exists, and null if it does not. This will search name AND alias.- Parameters:
name
- The name or alias of the world to get.- Returns:
- A
MultiverseWorld
or null.
-
getMVWorld
MultiverseWorld getMVWorld(java.lang.String name, boolean checkAliases)
Returns aMultiverseWorld
if the world with name given exists, and null if it does not. This will search optionally for alias names.- Parameters:
name
- The name or optionally the alias of the world to get.checkAliases
- Indicates whether to check for world alias name.- Returns:
- A
MultiverseWorld
or null.
-
getMVWorld
MultiverseWorld getMVWorld(org.bukkit.World world)
Returns aMultiverseWorld
if it exists, and null if it does not.- Parameters:
world
- The Bukkit world to check.- Returns:
- A
MultiverseWorld
or null.
-
isMVWorld
boolean isMVWorld(java.lang.String name)
Checks to see if the given name is a validMultiverseWorld
Searches based on world name AND alias.- Parameters:
name
- The name or alias of the world to check.- Returns:
- True if the world exists, false if not.
-
isMVWorld
boolean isMVWorld(java.lang.String name, boolean checkAliases)
Checks to see if the given name is a validMultiverseWorld
. Optionally searches by alias is specified.- Parameters:
name
- The name or alias of the world to check.checkAliases
- Indicates whether to check for world alias name.- Returns:
- True if the world exists, false if not.
-
isMVWorld
boolean isMVWorld(org.bukkit.World world)
Checks to see if the given world is a validMultiverseWorld
.- Parameters:
world
- The Bukkit world to check.- Returns:
- True if the world has been loaded into MV2, false if not.
-
loadWorlds
void loadWorlds(boolean forceLoad)
Load the Worlds & Settings from the configuration file.- Parameters:
forceLoad
- If set to true, this will perform a total reset and not just load new worlds.
-
loadDefaultWorlds
void loadDefaultWorlds()
Loads the Worlds & Settings for any worlds that bukkit loaded before us.This way people will _always_ have some worlds in the list.
-
getWorldPurger
@Deprecated PurgeWorlds getWorldPurger()
Deprecated.PurgeWorlds
is deprecated!Return the World Purger.- Returns:
- A valid
PurgeWorlds
.
-
getTheWorldPurger
WorldPurger getTheWorldPurger()
Gets theWorldPurger
.TODO: Remove
getWorldPurger()
and replace it with this method.- Returns:
- The
WorldPurger
thisMVWorldManager
is using. - See Also:
WorldPurger
,SimpleWorldPurger
-
getSpawnWorld
MultiverseWorld getSpawnWorld()
Gets the world players will spawn in on first join. Currently this always returns worlds.get(0) from Bukkit.- Returns:
- A Multiverse world that players will spawn in or null if no MV world has been set.
-
getUnloadedWorlds
java.util.List<java.lang.String> getUnloadedWorlds()
Gets the list of worlds in the config, but unloaded.- Returns:
- A List of worlds as strings.
-
getDefaultWorldGenerators
void getDefaultWorldGenerators()
This method populates an internal list and needs to be called after multiverse initialization.
-
loadWorldConfig
org.bukkit.configuration.file.FileConfiguration loadWorldConfig(java.io.File file)
Load the config from a file.- Parameters:
file
- The file to load.- Returns:
- A loaded configuration.
-
saveWorldsConfig
boolean saveWorldsConfig()
Saves the world config to disk.- Returns:
- True if success, false if fail.
-
removeWorldFromConfig
boolean removeWorldFromConfig(java.lang.String name)
Remove the world from the Multiverse list and from the config.- Parameters:
name
- The name of the world to remove- Returns:
- True if success, false if failure.
-
setFirstSpawnWorld
void setFirstSpawnWorld(java.lang.String world)
Sets the initial spawn world for new players.- Parameters:
world
- The World new players should spawn in.
-
getFirstSpawnWorld
MultiverseWorld getFirstSpawnWorld()
Gets the world players should spawn in first.- Returns:
- The
MultiverseWorld
new players should spawn in.
-
regenWorld
boolean regenWorld(java.lang.String name, boolean useNewSeed, boolean randomSeed, java.lang.String seed)
Regenerates a world.- Parameters:
name
- Name of the world to regenerateuseNewSeed
- If a new seed should be usedrandomSeed
- If the new seed should be randomseed
- The seed of the world.- Returns:
- True if success, false if fail.
-
regenWorld
boolean regenWorld(java.lang.String name, boolean useNewSeed, boolean randomSeed, java.lang.String seed, boolean keepGameRules)
Regenerates a world.- Parameters:
name
- Name of the world to regenerateuseNewSeed
- If a new seed should be usedrandomSeed
- If the new seed should be randomseed
- The seed of the world.keepGameRules
- If GameRules should be kept on world regen.- Returns:
- True if success, false if fail.
-
isKeepingSpawnInMemory
boolean isKeepingSpawnInMemory(org.bukkit.World world)
-
hasUnloadedWorld
boolean hasUnloadedWorld(java.lang.String name, boolean includeLoaded)
Checks whether Multiverse knows about a provided unloaded world. This method will check the parameter against the alias mappings.- Parameters:
name
- The name of the unloaded worldincludeLoaded
- The value to return if the world is loaded- Returns:
- True if the world exists and is unloaded. False if the world
does not exist.
includeLoaded
if the world exists and is loaded.
-
getPotentialWorlds
java.util.Collection<java.lang.String> getPotentialWorlds()
Get all the possible worlds that Multiverse has detected to be importable.- Returns:
- A collection of world names that are deemed importable.
-
-