Class PlayerProfile



  • public final class PlayerProfile
    extends Object
    A class that can store a Player's Research progress for caching purposes. It also holds the backpacks of a Player.
    Author:
    TheBusyBiscuit
    See Also:
    Research, PlayerBackpack
    • Method Detail

      • getConfig

        public io.github.thebusybiscuit.cscorelib2.config.Config getConfig​()
      • getUUID

        public UUID getUUID​()
      • isMarkedForDeletion

        public boolean isMarkedForDeletion​()
        This method returns whether the Player 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 the Research
        Parameters:
        research - The Research that should be unlocked or locked
        unlock - Whether the Research should be unlocked or locked
      • hasUnlocked

        public boolean hasUnlocked​(Research research)
        This method returns whether the Player has unlocked the given Research
        Parameters:
        research - The Research that is being queried
        Returns:
        Whether this Research has been unlocked
      • getResearches

        public Set<Research> getResearches​()
        This Method will return all Researches that this Player has unlocked
        Returns:
        A Hashset<Research> of all Researches this Player 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.
      • getTitle

        public String getTitle​()
      • getPlayer

        public Player getPlayer​()
      • getGuideHistory

        public GuideHistory getGuideHistory​()
      • fromUUID

        public static PlayerProfile fromUUID​(UUID uuid)
        This is now deprecated, use fromUUID(UUID, Consumer) instead
        Parameters:
        uuid - The UUID of the profile you are trying 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 retrieve
        callback - The callback with the PlayerProfile
        Returns:
        If the player was cached or not.
      • isLoaded

        public static boolean isLoaded​(UUID uuid)