Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 3050e36

Browse files
committed
Refactor NextCore command help messages and reload responses to use configuration file
1 parent 2c4c649 commit 3050e36

2 files changed

Lines changed: 27 additions & 16 deletions

File tree

src/main/java/gg/nextforge/command/builtin/NextCoreCommand.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@ private void registerCommands() {
2323
}
2424

2525
private void handleRootCommand(CommandContext context) {
26-
context.replyMini("<gold>╔════════════</gold> <yellow>NextCore v" + plugin.getPluginVersion() + "</yellow> <gold>═════════════</gold>");
27-
context.replyMini("<gold>║</gold> ");
28-
context.replyMini("<gold>║</gold> <gray>/nextcore <yellow>reload</yellow><dark_gray> - </dark_gray>Reloads the NextCore configuration");
29-
context.replyMini("<gold>║</gold> <gray>/nextcore <yellow>version</yellow><dark_gray> - </dark_gray>Displays the NextCore version");
30-
context.replyMini("<gold>║</gold> <gray>/nextcore <yellow>debug</yellow><dark_gray> - </dark_gray>Toggles debug mode for NextCore");
31-
context.replyMini("<gold>║</gold> <gray>/nextcore <yellow>info</yellow><dark_gray> - </dark_gray>Get server information");
32-
context.replyMini("<gold>║</gold> <gray>/nextcore <yellow>test</yellow><dark_gray> - </dark_gray>Run test commands");
33-
context.replyMini("<gold>║</gold> <gray>/nextcore <yellow>managers</yellow><dark_gray> - </dark_gray>See the managers doing their job");
34-
context.replyMini("<gold>║</gold> <gray>/nextcore <yellow>help</yellow><dark_gray> - </dark_gray>Shows this help message");
35-
context.replyMini("<gold>║</gold> ");
36-
context.replyMini("<gold>╚════════════</gold> <yellow>NextCore v" + plugin.getPluginVersion() + "</yellow> <gold>═════════════</gold>");
26+
plugin.getMessagesFile().getStringList("commands.nextcore.help").forEach(line -> {
27+
line = line.replace("%prefix%", plugin.getMessagesFile().getString("general.prefix", "<dark_gray>[<gradient:aqua:dark_aqua>ɴᴇxᴛᴄᴏʀᴇ<dark_gray>]</gradient></dark_gray>"));
28+
line = line.replace("%version%", plugin.getPluginVersion());
29+
line = line.replace("%author%", "NextForge Team");
30+
line = line.replace("%website%", "https://nextforge.gg");
31+
context.replyMini(line);
32+
});
3733
}
3834

3935
private void handleReloadCommand(CommandContext context) {
@@ -43,10 +39,10 @@ private void handleReloadCommand(CommandContext context) {
4339
plugin.getConfigManager().reloadAll();
4440

4541
long time = System.currentTimeMillis() - start;
46-
plugin.getTextManager().send(context.sender(), plugin.getMessagesFile().getString("reload.success", "%prefix% <green>Configuration reloaded successfully.</green> <gray>(%time%ms)</gray>").replace("%time%", time + ""));
42+
plugin.getTextManager().send(context.sender(), plugin.getMessagesFile().getString("commands.nextcore.reload.success", "%prefix% <green>Configuration reloaded successfully.</green> <gray>(%time%ms)</gray>").replace("%time%", time + ""));
4743
} catch (Exception e) {
4844
plugin.getSLF4JLogger().error("Failed to reload configuration", e);
49-
plugin.getTextManager().send(context.sender(), plugin.getMessagesFile().getString("reload.error", "%prefix% <red>Failed to reload configuration: %error%").replace("%error%", e.getMessage()));
45+
plugin.getTextManager().send(context.sender(), plugin.getMessagesFile().getString("commands.nextcore.reload.error", "%prefix% <red>Failed to reload configuration: %error%").replace("%error%", e.getMessage()));
5046
}
5147
}
5248

src/main/resources/messages.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@ general:
22
prefix: "<dark_gray>[<gradient:aqua:dark_aqua>ɴᴇxᴛᴄᴏʀᴇ<dark_gray>]</gradient></dark_gray>"
33
no-permission: "%prefix% <red>You do not have permission to perform this action.</red>"
44

5-
reload:
6-
success: "%prefix% <green>Configuration reloaded successfully.</green> <gray>(%time%ms)</gray>"
7-
failure: "%prefix% <red>Failed to reload configuration: %error%</red>"
5+
commands:
6+
nextcore:
7+
help:
8+
- "<gold>╔════════════</gold> <yellow>NextCore v%version%</yellow> <gold>═════════════</gold>"
9+
- "<gold>║</gold>"
10+
- "<gold>║</gold> <gray>/nextcore <yellow>reload</yellow><dark_gray> - </dark_gray>Reloads the NextCore configuration"
11+
- "<gold>║</gold> <gray>/nextcore <yellow>version</yellow><dark_gray> - </dark_gray>Displays the NextCore version"
12+
- "<gold>║</gold> <gray>/nextcore <yellow>debug</yellow><dark_gray> - </dark_gray>Toggles debug mode for NextCore"
13+
- "<gold>║</gold> <gray>/nextcore <yellow>update</yellow><dark_gray> - </dark_gray>Checks for updates to NextCore"
14+
- "<gold>║</gold> <gray>/nextcore <yellow>info</yellow><dark_gray> - </dark_gray>Get server information"
15+
- "<gold>║</gold> <gray>/nextcore <yellow>test</yellow><dark_gray> - </dark_gray>Run test commands"
16+
- "<gold>║</gold> <gray>/nextcore <yellow>managers</yellow><dark_gray> - </dark_gray>See the managers doing their job"
17+
- "<gold>║</gold> <gray>/nextcore <yellow>help</yellow><dark_gray> - </dark_gray>Displays this help message"
18+
- "<gold>║</gold>"
19+
- "<gold>╚════════════</gold> <yellow>NextCore v%version%</yellow> <gold>═════════════</gold>"
20+
reload:
21+
success: "%prefix% <green>Configuration reloaded successfully.</green> <gray>(%time%ms)</gray>"
22+
failure: "%prefix% <red>Failed to reload configuration: %error%</red>"

0 commit comments

Comments
 (0)