/mmoitems reload skills

This commit is contained in:
Indyuce 2022-01-09 14:37:20 +01:00
parent e2a667ab78
commit 1e1407cdfa

View File

@ -1,5 +1,6 @@
package net.Indyuce.mmoitems.command.mmoitems; package net.Indyuce.mmoitems.command.mmoitems;
import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.util.MMOItemReforger; 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("recipes", this, this::reloadRecipes));
addChild(new SubReloadCommandTreeNode("stations", this, this::reloadStations)); addChild(new SubReloadCommandTreeNode("stations", this, this::reloadStations));
addChild(new SubReloadCommandTreeNode("skills", this, this::reloadSkills));
addChild(new SubReloadCommandTreeNode("all", this, (sender) -> { addChild(new SubReloadCommandTreeNode("all", this, (sender) -> {
reloadMain(sender); reloadMain(sender);
reloadRecipes(sender); reloadRecipes(sender);
reloadStations(sender); reloadStations(sender);
reloadSkills(sender);
})); }));
} }
@ -28,9 +31,9 @@ public class ReloadCommandTreeNode extends CommandTreeNode {
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} }
public static class SubReloadCommandTreeNode extends CommandTreeNode { public class SubReloadCommandTreeNode extends CommandTreeNode {
private final Consumer<CommandSender> action; private final Consumer<CommandSender> action;
public SubReloadCommandTreeNode(String sub, CommandTreeNode parent, Consumer<CommandSender> action) { public SubReloadCommandTreeNode(String sub, CommandTreeNode parent, Consumer<CommandSender> action) {
super(parent, sub); super(parent, sub);
this.action = action; 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) { public void reloadMain(CommandSender sender) {
MMOItems.plugin.getEquipListener().reload(); MMOItems.plugin.getEquipListener().reload();
MMOItems.plugin.getLanguage().reload(); MMOItems.plugin.getLanguage().reload();