@@ -58,18 +58,19 @@ private EspConfigCommand() {
5858 public static void register (CommandDispatcher <FabricClientCommandSource > dispatcher ) {
5959 CommandNode <FabricClientCommandSource > cconfigRoot = dispatcher .getRoot ().getChild ("cconfig" );
6060 if (cconfigRoot == null ) {
61- // If the BetterConfig client command isn't present, register a direct sm:config fallback
61+ // BetterConfig client command not present: register direct fallback.
6262 registerDirectSmConfig (dispatcher );
6363 return ;
6464 }
65+
6566 CommandNode <FabricClientCommandSource > modRoot = cconfigRoot .getChild (SeedMapper .MOD_ID );
6667 if (modRoot == null ) {
67- // fallback to direct registration if mod -specific cconfig node missing
68+ // Mod -specific cconfig node missing: register direct fallback.
6869 registerDirectSmConfig (dispatcher );
6970 return ;
7071 }
7172
72- // Use a single target argument that accepts any case but suggests TitleCase names
73+ // Attach ESP-specific settings to existing sm:config/cconfig tree.
7374 com .mojang .brigadier .builder .RequiredArgumentBuilder <FabricClientCommandSource , String > targetArgNode = argument ("target" , StringArgumentType .word ())
7475 .suggests (EspConfigCommand ::suggestTargets );
7576 targetArgNode .then (literal ("get" )
@@ -82,8 +83,10 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
8283 .executes (ctx -> executeSet (ctx , getTargetArgument (ctx , "target" )))));
8384 targetArgNode .then (literal ("reset" )
8485 .executes (ctx -> executeReset (ctx , getTargetArgument (ctx , "target" ))));
86+
8587 modRoot .addChild (targetArgNode .build ());
8688 modRoot .addChild (buildZoomLiteral ("Zoom" ).build ());
89+ modRoot .addChild (buildEspTimeoutLiteral ().build ());
8790 }
8891
8992 private static void registerDirectSmConfig (CommandDispatcher <FabricClientCommandSource > dispatcher ) {
@@ -103,12 +106,16 @@ private static void registerDirectSmConfig(CommandDispatcher<FabricClientCommand
103106 .executes (ctx -> executeReset (ctx , getTargetArgument (ctx , "target" ))));
104107 smRoot .then (targetArgNode );
105108 smRoot .then (buildZoomLiteral ("Zoom" ));
106- // esptimeout top-level alias
107- smRoot .then (literal ("esptimeout" )
109+ smRoot .then (buildEspTimeoutLiteral ());
110+ dispatcher .register (smRoot );
111+ }
112+
113+ private static LiteralArgumentBuilder <FabricClientCommandSource > buildEspTimeoutLiteral () {
114+ return literal ("esptimeout" )
108115 .executes (ctx -> {
109116 CustomClientCommandSource source = CustomClientCommandSource .of (ctx .getSource ());
110117 source .sendFeedback (Component .literal ("EspTimeoutMinutes = " + Configs .EspTimeoutMinutes ));
111- return 1 ;
118+ return Command . SINGLE_SUCCESS ;
112119 })
113120 .then (argument ("minutes" , DoubleArgumentType .doubleArg (0.0 ))
114121 .executes (ctx -> {
@@ -117,9 +124,8 @@ private static void registerDirectSmConfig(CommandDispatcher<FabricClientCommand
117124 Configs .save ();
118125 RenderManager .setHighlightTimeout (Configs .EspTimeoutMinutes );
119126 CustomClientCommandSource .of (ctx .getSource ()).sendFeedback (Component .literal ("Updated EspTimeoutMinutes = " + minutes ));
120- return 1 ;
121- })));
122- dispatcher .register (smRoot );
127+ return Command .SINGLE_SUCCESS ;
128+ }));
123129 }
124130
125131 private static LiteralArgumentBuilder <FabricClientCommandSource > buildZoomLiteral (String literalName ) {
0 commit comments