use of org.spongepowered.common.data.SpongeKey in project SpongeCommon by SpongePowered.
the class KeyRegistryModule method registerAdditionalCatalog.
@Override
public void registerAdditionalCatalog(Key<?> extraCatalog) {
checkState(!SpongeDataManager.areRegistrationsComplete(), "Cannot register new Keys after Data Registration has completed!");
checkNotNull(extraCatalog, "Key cannot be null!");
final PluginContainer parent = ((SpongeKey) extraCatalog).getParent();
final String pluginId = parent.getId().toLowerCase(Locale.ENGLISH);
final String id = extraCatalog.getId().toLowerCase(Locale.ENGLISH);
final String[] split = id.split(":");
checkArgument(split.length == 2, "Key id's have to be in two parts! The first part being the plugin id, the second part being the key's individual id. Currently you have: " + Arrays.toString(split));
checkArgument(split[0].equals(pluginId), "A plugin is trying to register custom keys under a different plugin id namespace! This is unsupported! The provided key: " + id);
this.keyMap.put(id, extraCatalog);
}
Aggregations