Class RegionContainer
java.lang.Object
com.sk89q.worldguard.protection.regions.RegionContainer
A region container creates
RegionManager
s for loaded worlds, which
allows access to the region data of a world. Generally, only data is
loaded for worlds that are loaded in the server.
This class is thread safe and its contents can be accessed from multiple concurrent threads.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final QueryCache
protected RegionContainerImpl
protected final Object
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Execute auto-migration.Create a new region query.get
(com.sk89q.worldedit.world.World world) Get the region manager for a world if one exists.Get the region store driver.Get an immutable list of loadedRegionManager
s.Get the a set of region managers that are failing to save.void
Initialize the region container.protected abstract RegionManager
load
(com.sk89q.worldedit.world.World world) Load the region data for a world if it has not been loaded already.protected void
Try loading the region managers for all currently loaded worlds.void
Execute a migration and block any loading of region data during the migration.void
reload()
Reload the region container.void
unload()
Save data and unload.void
unload
(com.sk89q.worldedit.world.World world) Unload the region data for a world.
-
Field Details
-
lock
-
cache
-
container
-
-
Constructor Details
-
RegionContainer
public RegionContainer()
-
-
Method Details
-
initialize
public void initialize()Initialize the region container. -
unload
public void unload()Save data and unload. -
getDriver
Get the region store driver.- Returns:
- the driver
-
reload
public void reload()Reload the region container.This method may block until the data for all loaded worlds has been unloaded and new data has been loaded.
-
get
Get the region manager for a world if one exists.If you wish to make queries and performance is more important than accuracy, use
createQuery()
instead.This method may return
null
if region data for the given world has not been loaded, has failed to load, or support for regions has been disabled.- Parameters:
world
- the world- Returns:
- a region manager, or
null
if one is not available
-
getLoaded
Get an immutable list of loadedRegionManager
s.- Returns:
- a list of managers
-
getSaveFailures
Get the a set of region managers that are failing to save.- Returns:
- a set of region managers
-
createQuery
Create a new region query.- Returns:
- a new query
-
migrate
Execute a migration and block any loading of region data during the migration.- Parameters:
migration
- the migration- Throws:
MigrationException
- thrown by the migration on error
-
loadWorlds
protected void loadWorlds()Try loading the region managers for all currently loaded worlds. -
unload
public void unload(com.sk89q.worldedit.world.World world) Unload the region data for a world.- Parameters:
world
- a world
-
autoMigrate
protected void autoMigrate()Execute auto-migration. -
load
Load the region data for a world if it has not been loaded already.- Parameters:
world
- the world- Returns:
- a region manager, either returned from the cache or newly loaded
-