All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.handyplus.lib.attribute.MmoPlayerInventory Maven / Gradle / Ivy

There is a newer version: 1.1.5
Show newest version
package cn.handyplus.lib.attribute;

import cn.handyplus.lib.expand.adapter.HandySchedulerUtil;
import io.lumine.mythic.lib.api.player.EquipmentSlot;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.player.inventory.EquippedItem;
import net.Indyuce.mmoitems.comp.inventory.PlayerInventory;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
 * 集成mmo
 *
 * @author handy
 */
public class MmoPlayerInventory implements PlayerInventory {

    protected static final Map> MMO_ITEMS_BUFF_MAP = new HashMap<>();

    protected MmoPlayerInventory() {
        HandySchedulerUtil.runTask(() -> MMOItems.plugin.registerPlayerInventory(this));
    }

    @Override
    public List getInventory(Player player) {
        List list = new ArrayList<>();
        List itemStacks = MMO_ITEMS_BUFF_MAP.get(player.getUniqueId());
        if (itemStacks == null || itemStacks.isEmpty()) {
            return list;
        }
        itemStacks.forEach(item -> list.add(new AttributeLegacyEquippedItem(item)));
        return list;
    }

    /**
     * mmo自己实现装备类
     */
    public static class AttributeLegacyEquippedItem extends EquippedItem {
        /**
         * mmo自己实现装备类
         *
         * @param itemStack 装备
         */
        public AttributeLegacyEquippedItem(ItemStack itemStack) {
            super(itemStack, EquipmentSlot.ACCESSORY);
        }

        public void setItem(ItemStack var1) {

        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy