Skip to content

Commit 2d3ed02

Browse files
committed
Fixed config loading
1 parent cc1e825 commit 2d3ed02

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

common/src/main/kotlin/com/lambda/config/Configuration.kt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,26 @@ abstract class Configuration : Jsonable {
6262
get() = File("${primary.parent}/${primary.nameWithoutExtension}-backup.${primary.extension}")
6363

6464
init {
65-
tryLoad() // ToDo: This will do at the moment but i'd like to run this at the first first loadable stage
65+
// We need to implement a dependency graph of loadables and add functions to run before
66+
// and/or after a given Loadable children class is initialized
67+
//
68+
// class Load1(
69+
// override val priority = 1000,
70+
// override val before = Load2,
71+
// ) : Loadable {}
72+
//
73+
// class Load2(
74+
// override val priority = 1000,
75+
// ) : Loadable {}
76+
//
77+
// class Load3(
78+
// override val priority = 1000,
79+
// override val after = Load2,
80+
// ) : Loadable {}
81+
//
82+
// clientLifecycle<Load2>(shift = Pre) { event -> } // Will run before Load2
83+
// clientLifecycle<Load2>(shift = Post) { event -> } // Will run after Load2
84+
listenUnsafe<ClientEvent.Startup> { tryLoad() }
6685
listenUnsafe<ClientEvent.Shutdown>(Int.MIN_VALUE) { trySave() }
6786

6887
register()

0 commit comments

Comments
 (0)