Class PlayerBackpack

java.lang.Object
city.norain.slimefun4.holder.SlimefunInventoryHolder
io.github.thebusybiscuit.slimefun4.api.player.PlayerBackpack
All Implemented Interfaces:
org.bukkit.inventory.InventoryHolder

public class PlayerBackpack extends SlimefunInventoryHolder
This class represents the instance of a SlimefunBackpack that is ready to be opened. It holds an actual Inventory and represents the backpack on the level of an individual ItemStack as opposed to the class SlimefunBackpack.
See Also:
  • Field Details

  • Constructor Details

    • PlayerBackpack

      @ParametersAreNonnullByDefault public PlayerBackpack(org.bukkit.OfflinePlayer owner, UUID uuid, String name, int id, int size, @Nullable org.bukkit.inventory.ItemStack[] contents)
  • Method Details

    • getAsync

      public static void getAsync(org.bukkit.inventory.ItemStack item, Consumer<PlayerBackpack> callback, boolean runCbOnMainThread)
    • getAsync

      public static CompletableFuture<PlayerBackpack> getAsync(org.bukkit.inventory.ItemStack item)
    • getBackpackUUID

      public static Optional<String> getBackpackUUID(org.bukkit.inventory.meta.ItemMeta meta)
    • getOwnerUUID

      public static Optional<String> getOwnerUUID(org.bukkit.inventory.meta.ItemMeta meta)
    • getBackpackID

      public static OptionalInt getBackpackID(org.bukkit.inventory.meta.ItemMeta meta)
    • setItemPdc

      public static void setItemPdc(org.bukkit.inventory.ItemStack item, String bpUuid, String ownerUuid)
    • bindItem

      public static void bindItem(org.bukkit.inventory.ItemStack item, PlayerBackpack bp)
    • setItemDisplayInfo

      public static void setItemDisplayInfo(org.bukkit.inventory.ItemStack item, PlayerBackpack bp)
    • isOwnerOnline

      public static boolean isOwnerOnline(org.bukkit.inventory.meta.ItemMeta meta)
    • refreshSnapshot

      public void refreshSnapshot()
      This refreshes the internal snapshot, It should be called after every database writing task It should not be called elsewhere
    • getId

      public int getId()
      This returns the id of this PlayerBackpack
      Returns:
      The id of this PlayerBackpack
    • getOwner

      @Nonnull public org.bukkit.OfflinePlayer getOwner()
      This method returns the PlayerProfile this PlayerBackpack belongs to
      Returns:
      The owning PlayerProfile
    • getSize

      public int getSize()
      This returns the size of this PlayerBackpack.
      Returns:
      The size of this PlayerBackpack
    • getInventory

      @Nonnull public org.bukkit.inventory.Inventory getInventory()
      This method returns the Inventory of this PlayerBackpack
      Returns:
      The Inventory of this PlayerBackpack
    • open

      public void open(org.bukkit.entity.Player p)
      This will open the Inventory of this backpack to every Player that was passed onto this method.

      二进制兼容

      Parameters:
      p - The player who this Backpack will be shown to
    • setSize

      public void setSize(int size)
      This will change the current size of this Backpack to the specified size.
      Parameters:
      size - The new size for this Backpack
    • getUniqueId

      public UUID getUniqueId()
    • setName

      public void setName(String name)
    • getName

      public String getName()
    • markInvalid

      public void markInvalid()
    • isInvalid

      public boolean isInvalid()