mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-08-30 05:40:34 +00:00
load addons in separate method
This commit is contained in:
@@ -121,7 +121,6 @@ public abstract class AbstractPlatform implements Platform {
|
||||
logger.error("Error loading config.yml resource from jar", e);
|
||||
}
|
||||
|
||||
|
||||
config.load(this); // load config.yml
|
||||
|
||||
if(config.dumpDefaultConfig()) {
|
||||
@@ -134,6 +133,23 @@ public abstract class AbstractPlatform implements Platform {
|
||||
profiler.start();
|
||||
}
|
||||
|
||||
InternalAddon internalAddon = loadAddons();
|
||||
|
||||
eventManager.getHandler(FunctionalEventHandler.class)
|
||||
.register(internalAddon, PlatformInitializationEvent.class)
|
||||
.then(event -> {
|
||||
logger.info("Loading config packs...");
|
||||
configRegistry.loadAll(this);
|
||||
logger.info("Loaded packs.");
|
||||
})
|
||||
.global();
|
||||
|
||||
|
||||
logger.info("Terra addons successfully loaded.");
|
||||
logger.info("Finished initialization.");
|
||||
}
|
||||
|
||||
protected InternalAddon loadAddons() {
|
||||
List<BaseAddon> addonList = new ArrayList<>();
|
||||
|
||||
InternalAddon internalAddon = new InternalAddon();
|
||||
@@ -156,6 +172,7 @@ public abstract class AbstractPlatform implements Platform {
|
||||
bootstrapAddon.loadAddons(addonsFolder, getClass().getClassLoader())
|
||||
.forEach(addonList::add);
|
||||
});
|
||||
|
||||
addonList.sort(Comparator.comparing(StringIdentifiable::getID));
|
||||
if(logger.isInfoEnabled()) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
@@ -184,18 +201,7 @@ public abstract class AbstractPlatform implements Platform {
|
||||
}
|
||||
});
|
||||
|
||||
eventManager.getHandler(FunctionalEventHandler.class)
|
||||
.register(internalAddon, PlatformInitializationEvent.class)
|
||||
.then(event -> {
|
||||
logger.info("Loading config packs...");
|
||||
configRegistry.loadAll(this);
|
||||
logger.info("Loaded packs.");
|
||||
})
|
||||
.global();
|
||||
|
||||
|
||||
logger.info("Terra addons successfully loaded.");
|
||||
logger.info("Finished initialization.");
|
||||
return internalAddon;
|
||||
}
|
||||
|
||||
protected void dumpResources() {
|
||||
|
||||
Reference in New Issue
Block a user