mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-18 14:50:56 +00:00
clean up addon registry initialization
This commit is contained in:
@@ -54,13 +54,7 @@ public abstract class AbstractTerraPlugin implements TerraPlugin {
|
|||||||
|
|
||||||
private final CommandManager manager = new TerraCommandManager(this);
|
private final CommandManager manager = new TerraCommandManager(this);
|
||||||
|
|
||||||
private final AddonRegistry addonRegistry = Construct.construct(() -> {
|
private final AddonRegistry addonRegistry;
|
||||||
Optional<TerraAddon> addon = getPlatformAddon();
|
|
||||||
AddonRegistry registry = addon.map(terraAddon -> new AddonRegistry(terraAddon, this)).orElseGet(() -> new AddonRegistry(this));
|
|
||||||
InternalAddon internalAddon = new InternalAddon(this);
|
|
||||||
registry.register(internalAddon);
|
|
||||||
return registry;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
public AbstractTerraPlugin() {
|
public AbstractTerraPlugin() {
|
||||||
@@ -76,6 +70,9 @@ public abstract class AbstractTerraPlugin implements TerraPlugin {
|
|||||||
profiler.start();
|
profiler.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addonRegistry = getPlatformAddon().map(terraAddon -> new AddonRegistry(terraAddon, this)).orElseGet(() -> new AddonRegistry(this));
|
||||||
|
addonRegistry.register(new InternalAddon(this));
|
||||||
|
|
||||||
if(!addonRegistry.loadAll(getClass().getClassLoader())) { // load all addons
|
if(!addonRegistry.loadAll(getClass().getClassLoader())) { // load all addons
|
||||||
throw new IllegalStateException("Failed to load addons. Please correct addon installations to continue.");
|
throw new IllegalStateException("Failed to load addons. Please correct addon installations to continue.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user