File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
src/main/java/top/seraphjack/rmc Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 1111import net .neoforged .neoforge .event .RegisterCommandsEvent ;
1212import net .neoforged .neoforge .event .server .ServerStartedEvent ;
1313import net .neoforged .neoforge .event .server .ServerStoppingEvent ;
14+ import net .neoforged .neoforgespi .language .IModInfo ;
1415import org .slf4j .Logger ;
1516import org .slf4j .LoggerFactory ;
1617import top .seraphjack .backupcore .BackupCore ;
@@ -30,8 +31,11 @@ public final class RMC {
3031 static BackupCore backupCore ;
3132 static List <Snapshot > snapshotListCache = List .of ();
3233
34+ static IModInfo modInfo ;
35+
3336 public RMC (ModContainer modContainer ) {
3437 modContainer .registerConfig (ModConfig .Type .COMMON , Config .SPEC );
38+ modInfo = modContainer .getModInfo ();
3539 }
3640
3741 @ SubscribeEvent
Original file line number Diff line number Diff line change @@ -50,7 +50,8 @@ static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
5050 .requires (p -> p .hasPermission (4 ))
5151 .then (argument ("snapshot" , StringArgumentType .string ())
5252 .executes (RMCCommand ::restore )))
53-
53+ .then (literal ("version" )
54+ .executes (RMCCommand ::version ))
5455 );
5556 }
5657
@@ -101,4 +102,8 @@ private static int restore(CommandContext<CommandSourceStack> context) {
101102 return SINGLE_SUCCESS ;
102103 }
103104
105+ private static int version (CommandContext <CommandSourceStack > context ) {
106+ context .getSource ().sendSuccess (() -> Component .literal ("RMC version " + RMC .modInfo .getVersion ()), false );
107+ return SINGLE_SUCCESS ;
108+ }
104109}
You can’t perform that action at this time.
0 commit comments