ConfigType#getTypeClass -> getTypeKey

This commit is contained in:
dfsek
2021-07-22 13:04:33 -07:00
parent 9359ba0c97
commit 82169f0921
10 changed files with 19 additions and 19 deletions

View File

@@ -199,12 +199,12 @@ public class ConfigPackImpl implements ConfigPack {
private ConfigTypeRegistry createRegistry() {
return new ConfigTypeRegistry(main, (id, configType) -> {
OpenRegistry<?> openRegistry = configType.registrySupplier(this).get();
if(registryMap.containsKey(configType.getTypeClass().getType())) { // Someone already registered something; we need to copy things to the new registry.
registryMap.get(configType.getTypeClass().getType()).getLeft().forEach(((OpenRegistry<Object>) openRegistry)::register);
if(registryMap.containsKey(configType.getTypeKey().getType())) { // Someone already registered something; we need to copy things to the new registry.
registryMap.get(configType.getTypeKey().getType()).getLeft().forEach(((OpenRegistry<Object>) openRegistry)::register);
}
selfLoader.registerLoader(configType.getTypeClass().getType(), openRegistry);
abstractConfigLoader.registerLoader(configType.getTypeClass().getType(), openRegistry);
registryMap.put(configType.getTypeClass().getType(), ImmutablePair.of(openRegistry, new CheckedRegistryImpl<>(openRegistry)));
selfLoader.registerLoader(configType.getTypeKey().getType(), openRegistry);
abstractConfigLoader.registerLoader(configType.getTypeKey().getType(), openRegistry);
registryMap.put(configType.getTypeKey().getType(), ImmutablePair.of(openRegistry, new CheckedRegistryImpl<>(openRegistry)));
});
}
@@ -265,7 +265,7 @@ public class ConfigPackImpl implements ConfigPack {
}
for(ConfigType<?, ?> configType : configTypeRegistry.entries()) { // Load the configs
CheckedRegistry registry = getCheckedRegistry(configType.getTypeClass());
CheckedRegistry registry = getCheckedRegistry(configType.getTypeKey());
main.getEventManager().callEvent(new ConfigTypePreLoadEvent(configType, registry, this));
for(AbstractConfiguration config : abstractConfigLoader.loadConfigs(configs.getOrDefault(configType, Collections.emptyList()))) {
try {

View File

@@ -22,7 +22,7 @@ public class ConfigTypeRegistry extends OpenRegistryImpl<ConfigType<?, ?>> {
@Override
public boolean register(String identifier, Entry<ConfigType<?, ?>> value) {
callback.accept(identifier, value.getValue());
main.getDebugLogger().info("Registered config registry with ID " + identifier + " to type " + ReflectionUtil.typeToString(value.getValue().getTypeClass().getType()));
main.getDebugLogger().info("Registered config registry with ID " + identifier + " to type " + ReflectionUtil.typeToString(value.getValue().getTypeKey().getType()));
return super.register(identifier, value);
}
}