2023-03-30 17:19:42 +02:00
|
|
|
/*
|
|
|
|
|
* -------------------------------------------------------------------------------
|
|
|
|
|
* @author FalsePattern
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2023
|
|
|
|
|
*
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
* Distribution of the software in any form is only allowed with
|
|
|
|
|
* explicit, prior permission from the owner.
|
|
|
|
|
* -------------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
2023-03-09 21:44:17 +01:00
|
|
|
package com.falsepattern.chunk.api;
|
|
|
|
|
|
|
|
|
|
import com.falsepattern.chunk.internal.ChunkDataRegistryImpl;
|
|
|
|
|
|
2023-03-30 17:37:31 +02:00
|
|
|
import java.util.Set;
|
|
|
|
|
|
2023-03-09 21:44:17 +01:00
|
|
|
/**
|
|
|
|
|
* This class is used to register ChunkDataManagers.
|
2023-03-28 23:58:39 +02:00
|
|
|
* @see ChunkDataManager
|
2023-03-09 21:44:17 +01:00
|
|
|
*/
|
|
|
|
|
public class ChunkDataRegistry {
|
2023-03-28 23:58:39 +02:00
|
|
|
/**
|
|
|
|
|
* Registers a ChunkDataManager. Only do this during the preInit phase.
|
|
|
|
|
* @param manager The manager to register.
|
2023-03-29 21:58:34 +02:00
|
|
|
* @throws IllegalStateException If the registration stage is over.
|
|
|
|
|
* @throws IllegalArgumentException If the manager has a duplicate id.
|
2023-03-28 23:58:39 +02:00
|
|
|
*/
|
2023-03-30 17:17:11 +02:00
|
|
|
public static void registerDataManager(ChunkDataManager manager) throws IllegalStateException, IllegalArgumentException {
|
2023-03-09 21:44:17 +01:00
|
|
|
ChunkDataRegistryImpl.registerDataManager(manager);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-28 23:58:39 +02:00
|
|
|
/**
|
|
|
|
|
* Disables a ChunkDataManager. Only do this during the preInit phase.
|
|
|
|
|
* @param id The id of the manager to disable.
|
2023-03-29 21:58:34 +02:00
|
|
|
* @throws IllegalStateException If the disable stage is over.
|
2023-03-28 23:58:39 +02:00
|
|
|
*/
|
2023-03-29 21:58:34 +02:00
|
|
|
public static void disableDataManager(String domain, String id) throws IllegalStateException {
|
2023-03-29 00:26:15 +02:00
|
|
|
ChunkDataRegistryImpl.disableDataManager(domain, id);
|
2023-03-09 21:44:17 +01:00
|
|
|
}
|
2023-03-30 17:37:31 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns an unmodifiable set of all registered ChunkDataManagers.
|
|
|
|
|
* The id of a manager is its domain and id separated by a colon. (domain:id)
|
|
|
|
|
*/
|
|
|
|
|
public static Set<String> getRegisteredManagers() {
|
|
|
|
|
return ChunkDataRegistryImpl.getRegisteredManagers();
|
|
|
|
|
}
|
2023-03-09 21:44:17 +01:00
|
|
|
}
|