mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-22 04:37:42 +01:00
Reload inventories on stats reload
This commit is contained in:
parent
bfd75e5c99
commit
0db2980fda
@ -3,8 +3,11 @@ package net.Indyuce.mmoitems.command.mmoitems;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.util.MMOItemReforger;
|
||||
import net.Indyuce.mmoitems.api.util.NumericStatFormula;
|
||||
import net.Indyuce.mmoitems.comp.inventory.PlayerInventoryHandler;
|
||||
import net.Indyuce.mmoitems.comp.inventory.model.PlayerMMOInventory;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@ -50,6 +53,8 @@ public class ReloadCommandTreeNode extends CommandTreeNode {
|
||||
MythicLib.plugin.getSkills().initialize(true);
|
||||
MMOItems.plugin.getSkills().initialize(true);
|
||||
sender.sendMessage(MMOItems.plugin.getPrefix() + "Successfully reloaded " + MMOItems.plugin.getSkills().getAll().size() + " skills.");
|
||||
|
||||
reloadPlayerInventories();
|
||||
}
|
||||
|
||||
public void reloadMain(CommandSender sender) {
|
||||
@ -100,4 +105,13 @@ public class ReloadCommandTreeNode extends CommandTreeNode {
|
||||
sender.sendMessage(MMOItems.plugin.getPrefix() + "- " + ChatColor.RED
|
||||
+ MMOItems.plugin.getCrafting().countRecipes() + ChatColor.GRAY + " Recipes");
|
||||
}
|
||||
|
||||
public void reloadPlayerInventories() {
|
||||
PlayerData.getLoaded()
|
||||
.stream()
|
||||
.map(PlayerData::getInventory)
|
||||
.map(PlayerMMOInventory::getHandler)
|
||||
.peek(PlayerInventoryHandler::reset)
|
||||
.forEach(PlayerInventoryHandler::start);
|
||||
}
|
||||
}
|
||||
|
@ -68,4 +68,8 @@ public class PlayerMMOInventory {
|
||||
public List<EquippedItem> equipped() {
|
||||
return Collections.unmodifiableList(content);
|
||||
}
|
||||
|
||||
public PlayerInventoryHandler getHandler() {
|
||||
return handler;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user