Skip to content

Commit

Permalink
feat: reload command
Browse files Browse the repository at this point in the history
  • Loading branch information
darksaid98 committed Jul 3, 2023
1 parent d21ccef commit bb2f93d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = "com.aubrithehuman.repairtweaks"
version = "1.3.1"
version = "1.4.0"
description = ""

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public RepairTweaksCommand() {
new CommandAPICommand("info")
.executes(this::info),
new CommandAPICommand("tweaks")
.executes(this::tweaks)
.executes(this::tweaks),
new CommandAPICommand("reload")
.executes(this::reload)
)
.executes(this::info)
.register();
Expand All @@ -44,4 +46,12 @@ private void tweaks(CommandSender sender, CommandArguments args) {
new ColorParser(msg.toString()).build()
);
}

private void reload(CommandSender sender, CommandArguments args) {
CustomToolsHolder.getInstance().loadCustomRepairRecipes();

sender.sendMessage(
new ColorParser("%s Reloaded config.".formatted(ChatUtil.PREFIX)).build()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public static CustomToolsHolder getInstance() {
* load repair info from config
*/
public void loadCustomRepairRecipes() {
customTools.clear();

ConfigurationSection section = instance.getConfig().getConfigurationSection("customRepair");

if (section == null) {
Expand Down

0 comments on commit bb2f93d

Please sign in to comment.