@@ -9,6 +9,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent
99// #endif
1010
1111import dev.deftu.omnicore.client.OmniClientCommands
12+ import dev.deftu.textile.minecraft.MCSimpleTextHolder
1213import dev.deftu.textile.minecraft.MCTextFormat
1314
1415import java.io.File
@@ -70,24 +71,28 @@ object CrashPatch
7071 fun initialize () {
7172 OmniClientCommands .initialize()
7273
73- val command = CommandManager .literal(ID )
74- command.executes {
75- CrashPatchConfig .openUI()
76- 1
77- }
78- command.then(CommandManager .literal(" reload" ).executes { ctx ->
79- if (CrashScanStorage .downloadJson()) {
80- ctx.source.displayMessage(" ${MCTextFormat .GREEN } [CrashPatch] Successfully reloaded JSON file!" )
81- } else {
82- ctx.source.displayMessage(" ${MCTextFormat .RED } [CrashPatch] Failed to reload the JSON file!" )
74+ CommandManager .register(with (CommandManager .literal(ID )) {
75+ executes {
76+ CrashPatchConfig .openUI()
77+ 1
8378 }
84- 1
85- })
86- command.then(CommandManager .literal(" crash" ).executes { ctx ->
87- requestedCrash = true
88- 1
79+
80+ then(CommandManager .literal(" reload" ).executes { ctx ->
81+ val text = if (CrashScanStorage .downloadJson()) {
82+ MCSimpleTextHolder (" [${NAME } ] Successfully reloaded JSON file!" ).withFormatting(MCTextFormat .GREEN )
83+ } else {
84+ MCSimpleTextHolder (" [${NAME } ] Failed to reload JSON file!" ).withFormatting(MCTextFormat .RED )
85+ }
86+
87+ ctx.source.displayMessage(text)
88+ 1
89+ })
90+
91+ then(CommandManager .literal(" crash" ).executes { ctx ->
92+ requestedCrash = true
93+ 1
94+ })
8995 })
90- CommandManager .register(command)
9196
9297 CrashPatchConfig // Initialize the config
9398 }
0 commit comments