/*
* ChunkAPI
*
* Copyright (C) 2023-2024 FalsePattern
* All Rights Reserved
*
* The above copyright notice and this permission notice
* shall be included in all copies or substantial portions of the Software.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see
* This class is used to register ChunkDataManagers, as well as dispatch clone requests.
*
* @since 0.5.0
* @see DataManager
* @author FalsePattern
* @version 0.5.0
*/
@StableAPI(since = "0.5.0")
public class DataRegistry {
/**
* Registers a ChunkDataManager. Only do this during the init phase.
*
* @param manager The manager to register.
*
* @throws IllegalStateException If the registration stage is over.
* @throws IllegalArgumentException If the manager has a duplicate id.
*/
@StableAPI.Expose
public static void registerDataManager(DataManager manager)
throws IllegalStateException, IllegalArgumentException {
DataRegistryImpl.registerDataManager(manager);
}
/**
* Disables a ChunkDataManager. Only do this during the postInit phase.
*
* @param id The id of the manager to disable.
*
* @throws IllegalStateException If the disable stage is over.
*/
@StableAPI.Expose
public static void disableDataManager(String domain, String id) throws IllegalStateException {
DataRegistryImpl.disableDataManager(domain, id);
}
/**
* Returns an unmodifiable set of all registered ChunkDataManagers.
* The id of a manager is its domain and id separated by a colon. (domain:id)
*/
@Contract(pure = true)
@StableAPI.Expose
public static @Unmodifiable Set