mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-08-29 13:20:32 +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);
|
logger.error("Error loading config.yml resource from jar", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
config.load(this); // load config.yml
|
config.load(this); // load config.yml
|
||||||
|
|
||||||
if(config.dumpDefaultConfig()) {
|
if(config.dumpDefaultConfig()) {
|
||||||
@@ -134,6 +133,23 @@ public abstract class AbstractPlatform implements Platform {
|
|||||||
profiler.start();
|
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<>();
|
List<BaseAddon> addonList = new ArrayList<>();
|
||||||
|
|
||||||
InternalAddon internalAddon = new InternalAddon();
|
InternalAddon internalAddon = new InternalAddon();
|
||||||
@@ -156,6 +172,7 @@ public abstract class AbstractPlatform implements Platform {
|
|||||||
bootstrapAddon.loadAddons(addonsFolder, getClass().getClassLoader())
|
bootstrapAddon.loadAddons(addonsFolder, getClass().getClassLoader())
|
||||||
.forEach(addonList::add);
|
.forEach(addonList::add);
|
||||||
});
|
});
|
||||||
|
|
||||||
addonList.sort(Comparator.comparing(StringIdentifiable::getID));
|
addonList.sort(Comparator.comparing(StringIdentifiable::getID));
|
||||||
if(logger.isInfoEnabled()) {
|
if(logger.isInfoEnabled()) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
@@ -184,18 +201,7 @@ public abstract class AbstractPlatform implements Platform {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
eventManager.getHandler(FunctionalEventHandler.class)
|
return internalAddon;
|
||||||
.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 void dumpResources() {
|
protected void dumpResources() {
|
||||||
|
|||||||
Reference in New Issue
Block a user