Class YamlRegionFile
java.lang.Object
com.sk89q.worldguard.protection.managers.storage.file.YamlRegionFile
- All Implemented Interfaces:
RegionDatabase
A store that persists regions in a YAML-encoded file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()
Get a displayable name for this store.loadAll
(FlagRegistry flagRegistry) Load all regions from storage and place them into the passed map.void
saveAll
(Set<ProtectedRegion> regions) Replace all the data in the store with the given collection of regions.void
saveChanges
(RegionDifference difference) Perform a partial save that only commits changes, rather than the entire region index.
-
Constructor Details
-
YamlRegionFile
Create a new instance.- Parameters:
name
- the name of this storefile
- the file
-
-
Method Details
-
getName
Description copied from interface:RegionDatabase
Get a displayable name for this store.- Specified by:
getName
in interfaceRegionDatabase
-
loadAll
Description copied from interface:RegionDatabase
Load all regions from storage and place them into the passed map.The map will only be modified from one thread. The keys of each map entry will be in respect to the ID of the region but transformed to be lowercase. Until this method returns, the map may not be modified by any other thread simultaneously. If an exception is thrown, then the state in which the map is left is undefined.
The provided map should have reasonably efficient
get()
andput()
calls in order to maximize performance.- Specified by:
loadAll
in interfaceRegionDatabase
- Parameters:
flagRegistry
- a flag registry- Returns:
- a set of loaded regions
- Throws:
StorageException
- thrown on read error
-
saveAll
Description copied from interface:RegionDatabase
Replace all the data in the store with the given collection of regions.- Specified by:
saveAll
in interfaceRegionDatabase
- Parameters:
regions
- a set of regions- Throws:
StorageException
- thrown on write error
-
saveChanges
Description copied from interface:RegionDatabase
Perform a partial save that only commits changes, rather than the entire region index.- Specified by:
saveChanges
in interfaceRegionDatabase
- Parameters:
difference
- the difference- Throws:
DifferenceSaveException
- thrown if partial saves are not supported
-