From 1e1407cdfa1cc7c6cda33d132a004fd113dfeceb Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sun, 9 Jan 2022 14:37:20 +0100 Subject: [PATCH] /mmoitems reload skills --- .../command/mmoitems/ReloadCommandTreeNode.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmoitems/command/mmoitems/ReloadCommandTreeNode.java b/src/main/java/net/Indyuce/mmoitems/command/mmoitems/ReloadCommandTreeNode.java index 4bc999f2..75851454 100644 --- a/src/main/java/net/Indyuce/mmoitems/command/mmoitems/ReloadCommandTreeNode.java +++ b/src/main/java/net/Indyuce/mmoitems/command/mmoitems/ReloadCommandTreeNode.java @@ -1,5 +1,6 @@ package net.Indyuce.mmoitems.command.mmoitems; +import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.util.MMOItemReforger; @@ -15,10 +16,12 @@ public class ReloadCommandTreeNode extends CommandTreeNode { addChild(new SubReloadCommandTreeNode("recipes", this, this::reloadRecipes)); addChild(new SubReloadCommandTreeNode("stations", this, this::reloadStations)); + addChild(new SubReloadCommandTreeNode("skills", this, this::reloadSkills)); addChild(new SubReloadCommandTreeNode("all", this, (sender) -> { reloadMain(sender); reloadRecipes(sender); reloadStations(sender); + reloadSkills(sender); })); } @@ -28,9 +31,9 @@ public class ReloadCommandTreeNode extends CommandTreeNode { return CommandResult.SUCCESS; } - public static class SubReloadCommandTreeNode extends CommandTreeNode { + public class SubReloadCommandTreeNode extends CommandTreeNode { private final Consumer action; - + public SubReloadCommandTreeNode(String sub, CommandTreeNode parent, Consumer action) { super(parent, sub); this.action = action; @@ -43,6 +46,12 @@ public class ReloadCommandTreeNode extends CommandTreeNode { } } + public void reloadSkills(CommandSender sender) { + MythicLib.plugin.getSkills().initialize(true); + MMOItems.plugin.getSkills().initialize(true); + sender.sendMessage(MMOItems.plugin.getPrefix() + "Successfully reloaded " + MMOItems.plugin.getSkills().getAll().size() + " skills."); + } + public void reloadMain(CommandSender sender) { MMOItems.plugin.getEquipListener().reload(); MMOItems.plugin.getLanguage().reload();