Class DepositoryManager


  • public class DepositoryManager
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.util.HashMap<@NotNull java.lang.String,​@NotNull Depository> depositories
      记录仓库ID对应的仓库实例
      com.google.common.collect.HashMultimap<@NotNull java.lang.String,​@NotNull java.lang.String> itemMap
      用于记录储存每个物品ID所对应的背包ID
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<org.bukkit.inventory.ItemStack> collectItem​(org.bukkit.entity.Player player, java.util.Collection<org.bukkit.inventory.ItemStack> items)  
      boolean collectItem​(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack item)  
      @NotNull java.util.HashMap<@NotNull java.lang.String,​@NotNull Depository> getDepositories()  
      @Nullable Depository getDepository​(@NotNull java.lang.String depositoryID)  
      java.util.Set<Depository> getItemDepositories​(org.bukkit.inventory.ItemStack itemStack)  
      @Nullable java.util.Set<Depository> getItemDepositories​(org.bukkit.Material material, int data)  
      @Nullable java.lang.Double getItemPrice​(@NotNull java.lang.String depositoryID, @NotNull java.lang.String itemTypeID)
      获得某背包配置中的某件物品单价,最低为0。
      @Nullable java.lang.Integer getItemSellLimit​(@NotNull Depository depository, @NotNull java.lang.String itemTypeID)
      获得某背包配置中的某件物品每日售出限制,最低为0。
      @Nullable java.lang.Integer getItemSellLimit​(@NotNull java.lang.String depositoryID, @NotNull java.lang.String itemTypeID)
      获得某背包配置中的某件物品每日售出限制,最低为0。
      @NotNull java.lang.String getItemTypeID​(org.bukkit.inventory.ItemStack itemStack)  
      @NotNull java.lang.String getItemTypeID​(org.bukkit.Material material, int data)  
      java.util.Set<Depository> getPlayerUsableDepository​(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack itemStack)  
      boolean hasDepository​(@NotNull java.lang.String depositoryID)  
      boolean hasItem​(@NotNull Depository depository, @NotNull java.lang.String itemTypeID)  
      boolean hasItem​(@NotNull java.lang.String depositoryID, @NotNull java.lang.String itemTypeID)  
      void loadDepositories()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • depositories

        public java.util.HashMap<@NotNull java.lang.String,​@NotNull Depository> depositories
        记录仓库ID对应的仓库实例
      • itemMap

        public com.google.common.collect.HashMultimap<@NotNull java.lang.String,​@NotNull java.lang.String> itemMap
        用于记录储存每个物品ID所对应的背包ID
    • Constructor Detail

      • DepositoryManager

        public DepositoryManager()
    • Method Detail

      • loadDepositories

        public void loadDepositories()
      • getDepositories

        @NotNull
        public @NotNull java.util.HashMap<@NotNull java.lang.String,​@NotNull Depository> getDepositories()
      • hasDepository

        public boolean hasDepository​(@NotNull
                                     @NotNull java.lang.String depositoryID)
      • hasItem

        public boolean hasItem​(@NotNull
                               @NotNull java.lang.String depositoryID,
                               @NotNull
                               @NotNull java.lang.String itemTypeID)
      • hasItem

        public boolean hasItem​(@NotNull
                               @NotNull Depository depository,
                               @NotNull
                               @NotNull java.lang.String itemTypeID)
      • getDepository

        @Nullable
        public @Nullable Depository getDepository​(@NotNull
                                                  @NotNull java.lang.String depositoryID)
      • getItemDepositories

        public java.util.Set<Depository> getItemDepositories​(org.bukkit.inventory.ItemStack itemStack)
      • getItemDepositories

        @Nullable
        public @Nullable java.util.Set<Depository> getItemDepositories​(org.bukkit.Material material,
                                                                       int data)
      • getPlayerUsableDepository

        public java.util.Set<Depository> getPlayerUsableDepository​(org.bukkit.entity.Player player,
                                                                   org.bukkit.inventory.ItemStack itemStack)
      • getItemTypeID

        @NotNull
        public @NotNull java.lang.String getItemTypeID​(org.bukkit.Material material,
                                                       int data)
      • getItemTypeID

        @NotNull
        public @NotNull java.lang.String getItemTypeID​(org.bukkit.inventory.ItemStack itemStack)
      • collectItem

        public java.util.Collection<org.bukkit.inventory.ItemStack> collectItem​(org.bukkit.entity.Player player,
                                                                                java.util.Collection<org.bukkit.inventory.ItemStack> items)
      • collectItem

        public boolean collectItem​(org.bukkit.entity.Player player,
                                   org.bukkit.inventory.ItemStack item)
      • getItemPrice

        @Nullable
        public @Nullable java.lang.Double getItemPrice​(@NotNull
                                                       @NotNull java.lang.String depositoryID,
                                                       @NotNull
                                                       @NotNull java.lang.String itemTypeID)
        获得某背包配置中的某件物品单价,最低为0。
        Parameters:
        depositoryID - 背包ID
        itemTypeID - 物品ID
        Returns:
        若为空,则该背包或该物品不存在。
      • getItemSellLimit

        @Nullable
        public @Nullable java.lang.Integer getItemSellLimit​(@NotNull
                                                            @NotNull java.lang.String depositoryID,
                                                            @NotNull
                                                            @NotNull java.lang.String itemTypeID)
        获得某背包配置中的某件物品每日售出限制,最低为0。
        Parameters:
        depositoryID - 背包ID
        itemTypeID - 物品ID
        Returns:
        若为空,则该背包或该物品不存在。
      • getItemSellLimit

        @Nullable
        public @Nullable java.lang.Integer getItemSellLimit​(@NotNull
                                                            @NotNull Depository depository,
                                                            @NotNull
                                                            @NotNull java.lang.String itemTypeID)
        获得某背包配置中的某件物品每日售出限制,最低为0。
        Parameters:
        depository - 背包
        itemTypeID - 物品ID
        Returns:
        若为空,则该背包或该物品不存在。