java.lang.Object
eu.endercentral.crazy_advancements.advancement.Advancement

public class Advancement extends Object
Represents an Advancement
Author:
Axel
  • Constructor Details

    • Advancement

      public Advancement(@Nullable Advancement parent, NameKey name, AdvancementDisplay display, AdvancementFlag... flags)
      Constructor for Advancements with a parent
      Parameters:
      parent - Parent advancement
      name - Unique Identifier
      display - The Display of the Advancement
      flags - The flags which apply to this Advancement
    • Advancement

      public Advancement(@Nullable Advancement parent, NameKey name, AdvancementDisplay display, boolean childrenTracking, AdvancementFlag... flags)
      Constructor for Advancements with a parent and the option to disable children tracking
      Parameters:
      parent - Parent advancement
      name - Unique Identifier
      display - The Display of the Advancement
      childrenTracking - Whether children will be tracked. If false, direct children will not be cached resulting in methods like getRow() not containing advancements after this one. Advancements before this one will also be missing these advancements for the respective methods. Also certain behavior like AdvancementVisibility might not work as intended
      flags - The flags which apply to this Advancement
    • Advancement

      public Advancement(NameKey name, AdvancementDisplay display, AdvancementFlag... flags)
      Constructor for Root Advancements
      Parameters:
      name - Unique Identifier
      display - The Display of the Advancement
      flags - The flags which apply to this Advancement
    • Advancement

      public Advancement(NameKey name, AdvancementDisplay display, boolean childrenTracking, AdvancementFlag... flags)
      Constructor for Root Advancements with the option to disable children tracking
      Parameters:
      name - Unique Identifier
      display - The Display of the Advancement
      childrenTracking - Whether children will be tracked. If false, direct children will not be cached resulting in methods like getRow() not containing advancements after this one. Advancements before this one will also be missing these advancements for the respective methods. Also certain behavior like AdvancementVisibility might not work as intended
      flags - The flags which apply to this Advancement
  • Method Details

    • getName

      public NameKey getName()
      Get the Unique Identifier of this Advancement
      Returns:
      The Unique Identifier for this Advancement
    • hasName

      public boolean hasName(NameKey key)
      Checks whether this Advancement has a specific Name
      Parameters:
      key - Key to check
      Returns:
      true if Advancement name and key share the same namespace and name
    • getDisplay

      public AdvancementDisplay getDisplay()
      Get the Display of this Advancement
      Returns:
      the Display of this Advancement
    • setCriteria

      public void setCriteria(Criteria criteria)
      Sets the required Criteria that needs to be met in order to complete this Advancement
      Parameters:
      criteria - The required Criteria
    • getCriteria

      public Criteria getCriteria()
      Gets the required Criteria that needs to be met in order to complete this Advancement
      Returns:
      The required Criteria
    • setReward

      public void setReward(AdvancementReward reward)
      Sets the Reward of this Advancement
      Parameters:
      reward - The Reward that should be given to Players upon completing this Advancement
    • getReward

      public AdvancementReward getReward()
      Gets the Reward of this Advancement
      Returns:
      The Reward that gets awarded to Players upon completing this Advancement
    • getParent

      public Advancement getParent()
      Gets the Parent of this Advancement
      Returns:
      The Parent of this Advancement
    • isRoot

      public boolean isRoot()
      Gets whether this Advancement is a Root Advancement
      Returns:
      Whether this Advancement is a Root Advancement
    • getChildren

      public HashSet<Advancement> getChildren()
      Gets all direct Children
      Returns:
      All direct Children
    • getRootAdvancement

      public Advancement getRootAdvancement()
      Gets the Root Advancement
      Returns:
      The Root Advancement
    • getTab

      public NameKey getTab()
      Gets the Tab
      Returns:
      NameKey of the Tabs Root Advancement
    • getRow

      public List<Advancement> getRow()
      Gets all parents and children
      Returns:
      All parents and children
    • getRowUntil

      public List<Advancement> getRowUntil()
      Gets all parents
      Returns:
      All parents
    • getRowAfter

      public List<Advancement> getRowAfter()
      Gets all children
      Returns:
      All children
    • isAnythingGrantedUntil

      public boolean isAnythingGrantedUntil(Player player)
      Checks whether any parents have been granted
      Parameters:
      player - Player to check
      Returns:
      true if any parent is granted
    • isAnythingGrantedAfter

      public boolean isAnythingGrantedAfter(Player player)
      Checks whether any children have been granted
      Parameters:
      player - Player to check
      Returns:
      true if any child is granted
    • getProgress

      public AdvancementProgress getProgress(Player player)
      Gets a player's progress
      Parameters:
      player - The player to check
      Returns:
      The progress
    • getProgress

      public AdvancementProgress getProgress(UUID uuid)
      Gets a Player's progress
      Parameters:
      uuid - The uuid of the player to check
      Returns:
      The Player's progress
    • unloadProgress

      public void unloadProgress(Player player)
      Unloads the progress
      Will not update the player, use AdvancementManager.unloadProgress(Player player, Advancement...advancements) for online Players
      Parameters:
      player - Player to unload progress
    • unloadProgress

      public void unloadProgress(UUID uuid)
      Unloads the progress
      Will not update the player, use AdvancementManager.unloadProgress(UUID uuid, Advancement...advancements) for online Players
      Parameters:
      uuid - UUID of Player to unload progress
    • isGranted

      public boolean isGranted(Player player)
      Checks whether this Adavncement is granted to a certain player
      Parameters:
      player - Player to check
      Returns:
      true if advancement is granted
    • isGranted

      public boolean isGranted(UUID uuid)
      Checks whether this Adavncement is granted to a certain player
      Parameters:
      uuid - The uuid of the Player to check
      Returns:
      true if advancement is granted
    • getFlags

      public List<AdvancementFlag> getFlags()
      Gets a list of the applied Flags
      Returns:
      The list containing the flags
    • hasFlag

      public boolean hasFlag(AdvancementFlag flag)
      Checks whether this advancement has a certain flag
      Parameters:
      flag - The flag to check for
      Returns:
      Whether this advancement has the specified flag
    • saveVisibilityStatus

      public void saveVisibilityStatus(Player player, boolean visible)
      Saves the current Visibility Status for a Player, later the visibility is checked against this value to decide whether it changed
      Parameters:
      player - The Player to save the Visibility Status for
      visible - Whether the Visibility Status is true or false
    • getVisibilityStatus

      public boolean getVisibilityStatus(Player player)
      Gets the last saved Visibility Status
      Parameters:
      player - The Player to check
      Returns:
      The Visibility Status
    • unloadVisibilityStatus

      public void unloadVisibilityStatus(Player player)
      Unloads the Visibility Status for a Player
      Should only be run after somebody disconnects to free up RAM
      Parameters:
      player - The Player to Unload Visibility
    • unloadVisibilityStatus

      public void unloadVisibilityStatus(UUID uuid)
      Unloads the Visibility Status for a Player
      Should only be run after somebody disconnects to free up RAM
      Parameters:
      player - The UUID of Player to Unload Visibility
    • getToastNotification

      public ToastNotification getToastNotification()
      Gets a Toast Notification for this Advancement
      Returns:
      The Toast Notification
    • displayToast

      public void displayToast(Player player)
      Sends a Toast regardless if the Player has it in one of their Advancement Managers or not
      Parameters:
      player - Player who should see the Toast Message
    • getMessage

      public net.md_5.bungee.api.chat.BaseComponent getMessage(Player player)
      Gets an Advancement Message
      Parameters:
      player - Player who has recieved the advancement
      Returns:
      The Advancement Message as a Base Component
    • displayMessageToEverybody

      public void displayMessageToEverybody(Player player)
      Displays an Advancement Message to every Player saying Player has completed said advancement
      Note that this doesn't grant the advancement
      Parameters:
      player - Player who has recieved the advancement
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object