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
ConstructorDescriptionPlayerBackpack
(PlayerProfile profile, int id) Deprecated.PlayerBackpack
(PlayerProfile profile, int id, int size) Deprecated.UsenewBackpack(UUID, int, int)
instead -
Method Summary
Modifier and TypeMethodDescriptionint
getId()
This returns the id of thisPlayerBackpack
This method returns theInventory
of thisPlayerBackpack
getOwner()
Deprecated.UsegetOwnerId()
insteadint
getSize()
This returns the size of thisPlayerBackpack
.static PlayerBackpack
void
This method marks the backpack dirty, it will then be queued for an autosave usingsave()
static PlayerBackpack
newBackpack
(UUID ownerId, int id, int size) void
void
save()
Deprecated.Handled byPlayerProfile.save()
nowvoid
setSize
(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
- ThePlayerProfile
of this Backpackid
- The id of this Backpack
-
PlayerBackpack
Deprecated.UsenewBackpack(UUID, int, int)
insteadThis constructor creates a new Backpack- Parameters:
profile
- ThePlayerProfile
of 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 thePlayerProfile
thisPlayerBackpack
belongs 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 theInventory
of thisPlayerBackpack
- Returns:
- The
Inventory
of thisPlayerBackpack
-
open
- Parameters:
players
- The players who this Backpack will be shown to
-
closeForAll
This will close theInventory
of this backpack for everyPlayer
that 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