Class PlayerProfile
- java.lang.Object
-
- io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile
-
public final class PlayerProfile extends Object
A class that can store a Player'sResearch
progress for caching purposes. It also holds the backpacks of aPlayer
.- Author:
- TheBusyBiscuit
- See Also:
Research
,PlayerBackpack
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PlayerBackpack
createBackpack(int size)
static Optional<PlayerProfile>
find(OfflinePlayer p)
static PlayerProfile
fromUUID(UUID uuid)
This is now deprecated, usefromUUID(UUID, Consumer)
insteadstatic boolean
fromUUID(UUID uuid, Consumer<PlayerProfile> callback)
static PlayerProfile
get(OfflinePlayer p)
This is now deprecated, useget(OfflinePlayer, Consumer)
insteadstatic boolean
get(OfflinePlayer p, Consumer<PlayerProfile> callback)
Get the PlayerProfile for a player asynchronously.HashedArmorpiece[]
getArmor()
PlayerBackpack
getBackpack(int id)
static PlayerBackpack
getBackpack(ItemStack item)
io.github.thebusybiscuit.cscorelib2.config.Config
getConfig()
GuideHistory
getGuideHistory()
Player
getPlayer()
Set<Research>
getResearches()
This Method will return all Researches that thisPlayer
has unlockedString
getTitle()
UUID
getUUID()
boolean
hasUnlocked(Research research)
boolean
isDirty()
This method returns whether the Profile has unsaved changesstatic boolean
isLoaded(UUID uuid)
boolean
isMarkedForDeletion()
This method returns whether thePlayer
has logged off.static Iterator<PlayerProfile>
iterator()
void
markDirty()
Call this method if this Profile has unsaved changes.void
markForDeletion()
Call this method if the Player has left.void
save()
This method will save the Player's Researches and Backpacks to the hard drivevoid
sendStats(CommandSender sender)
void
setResearched(Research research, boolean unlock)
This method sets the Player's "researched" status for this Research.String
toString()
-
-
-
Method Detail
-
getArmor
public HashedArmorpiece[] getArmor()
-
getConfig
public io.github.thebusybiscuit.cscorelib2.config.Config getConfig()
-
getUUID
public UUID getUUID()
-
isMarkedForDeletion
public boolean isMarkedForDeletion()
This method returns whether thePlayer
has logged off. If this is true, then the Profile can be removed from RAM.- Returns:
- Whether the Profile is marked for deletion
-
isDirty
public boolean isDirty()
This method returns whether the Profile has unsaved changes- Returns:
- Whether there are unsaved changes
-
save
public void save()
This method will save the Player's Researches and Backpacks to the hard drive
-
setResearched
public void setResearched(Research research, boolean unlock)
This method sets the Player's "researched" status for this Research. Use the boolean to unlock or lock theResearch
-
hasUnlocked
public boolean hasUnlocked(Research research)
-
getResearches
public Set<Research> getResearches()
This Method will return all Researches that thisPlayer
has unlocked- Returns:
- A
Hashset<Research>
of all Researches thisPlayer
has unlocked
-
markForDeletion
public void markForDeletion()
Call this method if the Player has left. The profile can then be removed from RAM.
-
markDirty
public void markDirty()
Call this method if this Profile has unsaved changes.
-
createBackpack
public PlayerBackpack createBackpack(int size)
-
getBackpack
public PlayerBackpack getBackpack(int id)
-
getTitle
public String getTitle()
-
sendStats
public void sendStats(CommandSender sender)
-
getPlayer
public Player getPlayer()
-
getGuideHistory
public GuideHistory getGuideHistory()
-
fromUUID
public static PlayerProfile fromUUID(UUID uuid)
This is now deprecated, usefromUUID(UUID, Consumer)
instead- Parameters:
uuid
- The UUID of the profile you are trying to retrieve.- Returns:
- The PlayerProfile of this player
-
fromUUID
public static boolean fromUUID(UUID uuid, Consumer<PlayerProfile> callback)
-
get
public static PlayerProfile get(OfflinePlayer p)
This is now deprecated, useget(OfflinePlayer, Consumer)
instead- Parameters:
p
- The player's profile you wish to retrieve- Returns:
- The PlayerProfile of this player
-
get
public static boolean get(OfflinePlayer p, Consumer<PlayerProfile> callback)
Get the PlayerProfile for a player asynchronously.- Parameters:
p
- The player who's profile to retrievecallback
- The callback with the PlayerProfile- Returns:
- If the player was cached or not.
-
isLoaded
public static boolean isLoaded(UUID uuid)
-
find
public static Optional<PlayerProfile> find(OfflinePlayer p)
-
iterator
public static Iterator<PlayerProfile> iterator()
-
getBackpack
public static PlayerBackpack getBackpack(ItemStack item)
-
-