Search in sources :

Example 31 with StorageException

use of com.sk89q.worldguard.protection.managers.storage.StorageException in project WorldGuard by EngineHub.

the class RegionContainerImpl method unload.

/**
 * Unload the region manager associated with the given world name.
 *
 * <p>If no region manager has been loaded for the given name, then
 * nothing will happen.</p>
 *
 * @param name the name of the world
 */
public void unload(String name) {
    checkNotNull(name);
    Normal normal = Normal.normal(name);
    synchronized (lock) {
        RegionManager manager = mapping.get(normal);
        if (manager != null) {
            try {
                manager.save();
            } catch (StorageException e) {
                log.log(Level.WARNING, "Failed to save the region data for '" + name + "'", e);
            }
            mapping.remove(normal);
            failingSaves.remove(manager);
        }
        failingLoads.remove(normal);
    }
}
Also used : Normal(com.sk89q.worldguard.util.Normal) StorageException(com.sk89q.worldguard.protection.managers.storage.StorageException)

Aggregations

StorageException (com.sk89q.worldguard.protection.managers.storage.StorageException)31 RegionManager (com.sk89q.worldguard.protection.managers.RegionManager)19 BukkitWorld (com.sk89q.worldedit.bukkit.BukkitWorld)16 ProtectedRegion (com.sk89q.worldguard.protection.regions.ProtectedRegion)15 BlockVector3 (com.sk89q.worldedit.math.BlockVector3)9 DefaultDomain (com.sk89q.worldguard.domains.DefaultDomain)9 ProtectedCuboidRegion (com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion)9 Flag (com.sk89q.worldguard.protection.flags.Flag)6 StateFlag (com.sk89q.worldguard.protection.flags.StateFlag)6 Closer (com.sk89q.worldguard.util.io.Closer)5 SQLException (java.sql.SQLException)5 GlobalProtectedRegion (com.sk89q.worldguard.protection.regions.GlobalProtectedRegion)3 ProtectedPolygonalRegion (com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion)3 HashMap (java.util.HashMap)3 World (org.bukkit.World)3 YAMLNode (com.sk89q.util.yaml.YAMLNode)2 YAMLProcessor (com.sk89q.util.yaml.YAMLProcessor)2 BlockVector2 (com.sk89q.worldedit.math.BlockVector2)2 ApplicableRegionSet (com.sk89q.worldguard.protection.ApplicableRegionSet)2 RegionDatabase (com.sk89q.worldguard.protection.managers.storage.RegionDatabase)2