File tree Expand file tree Collapse file tree 3 files changed +11
-28
lines changed
src/main/kotlin/com/lambda Expand file tree Collapse file tree 3 files changed +11
-28
lines changed Original file line number Diff line number Diff line change @@ -63,26 +63,6 @@ abstract class Configuration : Jsonable {
6363 get() = File (" ${primary.parent} /${primary.nameWithoutExtension} -backup.${primary.extension} " )
6464
6565 init {
66- // We need to implement a dependency graph of loadables and add functions to run before
67- // and/or after a given Loadable children class is initialized
68- //
69- // class Load1(
70- // override val priority = 1000,
71- // override val before = Load2,
72- // ) : Loadable {}
73- //
74- // class Load2(
75- // override val priority = 1000,
76- // ) : Loadable {}
77- //
78- // class Load3(
79- // override val priority = 1000,
80- // override val after = Load2,
81- // ) : Loadable {}
82- //
83- // clientLifecycle<Load2>(shift = Pre) { event -> } // Will run before Load2
84- // clientLifecycle<Load2>(shift = Post) { event -> } // Will run after Load2
85- listenUnsafe<ClientEvent .Startup > { tryLoad() }
8666 listenUnsafe<ClientEvent .Shutdown >(Int .MIN_VALUE ) { trySave() }
8767
8868 register()
Original file line number Diff line number Diff line change 1818package com.lambda.config.configurations
1919
2020import com.lambda.config.Configuration
21- import com.lambda.util.FolderRegister
22- import java.io.File
21+ import com.lambda.core.Loadable
2322
24- object UserConfig : Configuration() {
25- override val configName get() = " preferences"
26- override val primary: File = FolderRegister .config.resolve(" $configName .json" ).toFile()
27- }
23+ object ConfigLoader: Loadable {
24+ override fun load (): String {
25+ Configuration .configurations.forEach {
26+ it.tryLoad()
27+ }
28+ return " Loaded ${Configuration .configurations.size} configurations"
29+ }
30+ }
Original file line number Diff line number Diff line change @@ -19,15 +19,15 @@ package com.lambda.network
1919
2020import com.lambda.Lambda.mc
2121import com.lambda.config.Configurable
22- import com.lambda.config.configurations.UserConfig
22+ import com.lambda.config.configurations.LambdaConfig
2323import com.lambda.core.Loadable
2424import com.lambda.network.api.v1.models.Authentication
2525import com.lambda.network.api.v1.models.Authentication.Data
2626import com.lambda.util.StringUtils.base64UrlDecode
2727import com.lambda.util.StringUtils.json
2828import com.lambda.util.collections.updatableLazy
2929
30- object NetworkManager : Configurable(UserConfig ), Loadable {
30+ object NetworkManager : Configurable(LambdaConfig ), Loadable {
3131 override val name = " network"
3232
3333 var accessToken by setting(" access_token" , " " ); private set
You can’t perform that action at this time.
0 commit comments