Class PlayerBackpack
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.player.PlayerBackpack
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.- Author:
- TheBusyBiscuit
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerBackpack(PlayerProfile profile, int id) Deprecated.PlayerBackpack(PlayerProfile profile, int id, int size) Deprecated.UsenewBackpack(UUID, int, int)instead -
Method Summary
Modifier and TypeMethodDescriptionintgetId()This returns the id of thisPlayerBackpackThis method returns theInventoryof thisPlayerBackpackgetOwner()Deprecated.UsegetOwnerId()insteadintgetSize()This returns the size of thisPlayerBackpack.static PlayerBackpackvoidThis method marks the backpack dirty, it will then be queued for an autosave usingsave()static PlayerBackpacknewBackpack(UUID ownerId, int id, int size) voidvoidsave()Deprecated.Handled byPlayerProfile.save()nowvoidsetSize(int size) This will change the current size of this Backpack to the specified size.
-
Constructor Details
-
PlayerBackpack
Deprecated.Useload(UUID, int, int, HashMap)insteadThis constructor loads an existing Backpack- Parameters:
profile- ThePlayerProfileof this Backpackid- The id of this Backpack
-
PlayerBackpack
Deprecated.UsenewBackpack(UUID, int, int)insteadThis constructor creates a new Backpack- Parameters:
profile- ThePlayerProfileof this Backpackid- The id of this Backpacksize- The size of this Backpack
-
-
Method Details
-
getId
public int getId()This returns the id of thisPlayerBackpack- Returns:
- The id of this
PlayerBackpack
-
getOwner
Deprecated.UsegetOwnerId()insteadThis method returns thePlayerProfilethisPlayerBackpackbelongs to- Returns:
- The owning
PlayerProfile
-
getOwnerId
-
getSize
public int getSize()This returns the size of thisPlayerBackpack.- Returns:
- The size of this
PlayerBackpack
-
getInventory
This method returns theInventoryof thisPlayerBackpack- Returns:
- The
Inventoryof thisPlayerBackpack
-
open
- Parameters:
players- The players who this Backpack will be shown to
-
closeForAll
This will close theInventoryof this backpack for everyPlayerthat has opened it. This process has to run on the main server thread.- Returns:
- A
CompletableFuture.
-
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
-
save
Deprecated.Handled byPlayerProfile.save()nowThis method will save the contents of this backpack to aFile. -
markDirty
public void markDirty()This method marks the backpack dirty, it will then be queued for an autosave usingsave() -
load
@ParametersAreNonnullByDefault public static PlayerBackpack load(UUID ownerId, int id, int size, HashMap<Integer, ItemStack> contents) -
newBackpack
@ParametersAreNonnullByDefault public static PlayerBackpack newBackpack(UUID ownerId, int id, int size)
-
load(UUID, int, int, HashMap)instead