@@ -17,11 +17,13 @@ public class CjmCommand implements CommandExecutor, TabCompleter {
1717 private final CustomJoinMessage plugin ;
1818 private final MessageManager messageManager ;
1919 private final PermissionCommand permissionCommand ;
20+ private final GroupCommand groupCommand ;
2021
2122 public CjmCommand (CustomJoinMessage plugin ) {
2223 this .plugin = plugin ;
2324 this .messageManager = plugin .getMessageManager ();
2425 this .permissionCommand = new PermissionCommand (plugin );
26+ this .groupCommand = new GroupCommand (plugin );
2527 }
2628
2729 @ Override
@@ -37,9 +39,34 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
3739 }
3840
3941 if (args [0 ].equalsIgnoreCase ("reload" )) {
40- plugin .reloadConfig ();
41- plugin .getConfigManager ().reloadConfig ();
42- messageManager .sendMessage (sender , "config-reloaded" );
42+ // Reload configuration and check if it was updated
43+ boolean configUpdated = plugin .getConfigManager ().reloadConfig ();
44+
45+ // Check if config was updated
46+ boolean configFileUpdated = plugin .getConfigManager ().getLastBackupFile () != null ;
47+ boolean messagesFileUpdated = plugin .getConfigManager ().getLastMessagesBackupFile () != null ;
48+
49+ // Send appropriate messages based on what was updated
50+ if (configFileUpdated ) {
51+ messageManager .sendMessage (sender , "config-updated" );
52+ String backupFile = plugin .getConfigManager ().getLastBackupFile ();
53+ if (backupFile != null ) {
54+ messageManager .sendMessage (sender , "config-backup-created" , "%backup_file%" , backupFile );
55+ }
56+ }
57+
58+ if (messagesFileUpdated ) {
59+ messageManager .sendMessage (sender , "messages-updated" );
60+ String backupFile = plugin .getConfigManager ().getLastMessagesBackupFile ();
61+ if (backupFile != null ) {
62+ messageManager .sendMessage (sender , "messages-backup-created" , "%backup_file%" , backupFile );
63+ }
64+ }
65+
66+ if (!configFileUpdated && !messagesFileUpdated ) {
67+ messageManager .sendMessage (sender , "config-reloaded" );
68+ }
69+
4370 return true ;
4471 }
4572
@@ -50,6 +77,13 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
5077 return permissionCommand .onCommand (sender , command , "permission" , permissionArgs );
5178 }
5279
80+ if (args [0 ].equalsIgnoreCase ("group" )) {
81+ // Forward group subcommand to GroupCommand
82+ String [] groupArgs = new String [args .length - 1 ];
83+ System .arraycopy (args , 1 , groupArgs , 0 , args .length - 1 );
84+ return groupCommand .onCommand (sender , command , "group" , groupArgs );
85+ }
86+
5387 // Unknown command
5488 messageManager .sendMessage (sender , "unknown-command" );
5589 return true ;
@@ -62,6 +96,7 @@ private void sendHelp(CommandSender sender) {
6296 // Send help commands
6397 messageManager .sendMessage (sender , "admin-help-reload" );
6498 messageManager .sendMessage (sender , "admin-help-permission" );
99+ messageManager .sendMessage (sender , "admin-help-group" );
65100 messageManager .sendMessage (sender , "admin-help-help" );
66101
67102 // Send config note
@@ -75,12 +110,18 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
75110 if (args .length == 1 ) {
76111 completions .add ("reload" );
77112 completions .add ("permission" );
113+ completions .add ("group" );
78114 completions .add ("help" );
79115 } else if (args .length == 2 && args [0 ].equalsIgnoreCase ("permission" )) {
80116 // Forward tab completion to PermissionCommand
81117 String [] permissionArgs = new String [args .length - 1 ];
82118 System .arraycopy (args , 1 , permissionArgs , 0 , args .length - 1 );
83119 return permissionCommand .onTabComplete (sender , command , "permission" , permissionArgs );
120+ } else if (args .length == 2 && args [0 ].equalsIgnoreCase ("group" )) {
121+ // Forward tab completion to GroupCommand
122+ String [] groupArgs = new String [args .length - 1 ];
123+ System .arraycopy (args , 1 , groupArgs , 0 , args .length - 1 );
124+ return groupCommand .onTabComplete (sender , command , "group" , groupArgs );
84125 }
85126
86127 // Filter completions based on what the user has typed
0 commit comments