@@ -19,7 +19,6 @@ package com.lambda.core.loader
1919
2020import com.lambda.Lambda
2121import com.lambda.Lambda.LOG
22- import com.lambda.graphics.renderer.gui.font.FontRenderer
2322import com.lambda.util.Communication.ascii
2423import com.lambda.util.reflections.getInstances
2524import kotlin.reflect.full.findAnnotation
@@ -33,20 +32,19 @@ object Loader {
3332 val runtime: String
3433 get() = " ${(System .currentTimeMillis() - started).toDuration(DurationUnit .MILLISECONDS )} "
3534
36- private val loadables =
37- getInstances<Loadable > { forPackages(" com.lambda" ) }
38- .associateWith { it::class .findAnnotation<LoaderOrder >() }
39- .toList()
40- .sortedBy { (_, annotation) -> annotation?.phase ? : Phase .Post }
41- // .sortedByDescending { (_, annotation) -> annotation?.priority }
42- .map { it.first }
35+ private val loadables = getInstances<Loadable > { forPackages(" com.lambda" ) }
36+ .associateWith { it::class .findAnnotation<LoaderOrder >() }
37+ .toList()
38+ .sortedWith(compareBy({ it.second?.phase ? : Phase .Post }, { it.second?.priority }))
4339
4440 fun initialize () {
4541 ascii.split(" \n " ).forEach { LOG .info(it) }
4642 LOG .info(" Initializing ${Lambda .MOD_NAME } ${Lambda .VERSION } " )
4743
4844 val time = measureTimeMillis {
49- loadables.forEach { LOG .info(it.load()) }
45+ loadables.forEach { (loadable, annotation) ->
46+ LOG .info(" [${annotation?.phase ? : Phase .Post } ] ${loadable.load()} " )
47+ }
5048 }
5149
5250 LOG .info(" ${Lambda .MOD_NAME } ${Lambda .VERSION } was successfully initialized in $time ms" )
0 commit comments