public class YamlRegionFile extends Object implements RegionDatabase
| Constructor and Description |
|---|
YamlRegionFile(String name,
File file)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getName()
Get a displayable name for this store.
|
Set<ProtectedRegion> |
loadAll()
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.
|
public String getName()
RegionDatabasegetName in interface RegionDatabasepublic Set<ProtectedRegion> loadAll() throws StorageException
RegionDatabaseThe 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() and put() calls in order to maximize performance.
loadAll in interface RegionDatabaseStorageException - thrown on read errorpublic void saveAll(Set<ProtectedRegion> regions) throws StorageException
RegionDatabasesaveAll in interface RegionDatabaseregions - a set of regionsStorageException - thrown on write errorpublic void saveChanges(RegionDifference difference) throws DifferenceSaveException
RegionDatabasesaveChanges in interface RegionDatabasedifference - the differenceDifferenceSaveException - thrown if partial saves are not supportedCopyright © 2015. All Rights Reserved.