File tree Expand file tree Collapse file tree 6 files changed +19
-32
lines changed
common/src/main/kotlin/com/lambda Expand file tree Collapse file tree 6 files changed +19
-32
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import com.lambda.event.events.ClientEvent
1111import com.lambda.event.listener.UnsafeListener.Companion.unsafeListener
1212import com.lambda.util.Communication.info
1313import com.lambda.util.Communication.logError
14+ import com.lambda.util.FolderRegister
1415import com.lambda.util.StringUtils.capitalize
1516import kotlinx.coroutines.Dispatchers
1617import kotlinx.coroutines.launch
@@ -33,13 +34,13 @@ import kotlin.concurrent.fixedRateTimer
3334 * @property primary The primary file where the configuration is saved.
3435 * @property configurables A set of [Configurable] objects that this configuration manages.
3536 */
36- abstract class Configuration : Jsonable {
37- abstract val configName: String
38- abstract val primary: File
37+ abstract class Configuration (
38+ val configName : String ,
39+ ) : Jsonable {
40+ private val primary = FolderRegister .config.resolve(" $configName .json" )
41+ private val backup = File (" ${primary.parent} /${primary.nameWithoutExtension} -backup.${primary.extension} " )
3942
4043 val configurables = mutableSetOf<Configurable >()
41- private val backup: File
42- get() = File (" ${primary.parent} /${primary.nameWithoutExtension} -backup.${primary.extension} " )
4344
4445 init {
4546 unsafeListener<ClientEvent .Startup > { tryLoad() }
Original file line number Diff line number Diff line change 11package com.lambda.config.configurations
22
33import com.lambda.config.Configuration
4- import com.lambda.util.FolderRegister
54
6- object FriendConfig : Configuration() {
7- override val configName get() = " friends"
8- override val primary = FolderRegister .config.resolve( " $configName .json " )
9- }
5+ /* *
6+ * The [FriendConfig] object represents the configuration file for the friends.
7+ */
8+ object FriendConfig : Configuration(configName = " friends " )
Original file line number Diff line number Diff line change 11package com.lambda.config.configurations
22
33import com.lambda.config.Configuration
4- import com.lambda.util.FolderRegister
54
6- object GuiConfig : Configuration() {
7- override val configName get() = " gui "
8- override val primary = FolderRegister .config.resolve( " $configName .json " )
9- }
5+ /* *
6+ * The [GuiConfig] object represents the configuration file for the GUI.
7+ */
8+ object GuiConfig : Configuration(configName = " gui " )
Original file line number Diff line number Diff line change 11package com.lambda.config.configurations
22
33import com.lambda.config.Configuration
4- import com.lambda.util.FolderRegister
54
6- object LambdaConfig : Configuration() {
7- override val configName get() = " lambda"
8- override val primary = FolderRegister .config.resolve( " $configName .json " )
9- }
5+ /* *
6+ * The [LambdaConfig] object represents the configuration file for the lambda.
7+ */
8+ object LambdaConfig : Configuration(configName = " lambda " )
Original file line number Diff line number Diff line change 11package com.lambda.config.configurations
22
33import com.lambda.config.Configuration
4- import com.lambda.config.configurations.ModuleConfig.configName
5- import com.lambda.config.configurations.ModuleConfig.primary
6- import com.lambda.util.FolderRegister
74
85
96/* *
107 * The [ModuleConfig] object represents the configuration file for the [Module]s.
118 *
129 * This object is used to save and load the settings of all [Module]s in the system.
13- *
14- * @property configName The name of the configuration.
15- * @property primary The primary file where the configuration is saved.
1610 */
17- object ModuleConfig : Configuration() {
18- override val configName get() = " modules"
19- override val primary = FolderRegister .config.resolve(" $configName .json" )
20- }
11+ object ModuleConfig : Configuration(configName = " modules" )
Original file line number Diff line number Diff line change @@ -6,8 +6,6 @@ import com.lambda.event.callback.Cancellable
66import com.lambda.event.callback.ICancellable
77import com.lambda.event.events.PacketEvent.Receive
88import com.lambda.event.events.PacketEvent.Send
9- import com.lambda.event.events.PacketEvent.Send.Post
10- import com.lambda.event.events.PacketEvent.Send.Pre
119import net.minecraft.network.packet.Packet
1210
1311/* *
You can’t perform that action at this time.
0 commit comments