Interface PlayerAchievements


public interface PlayerAchievements
  • Method Details

    • getPlayerUUID

      UUID getPlayerUUID()
      Returns the UUID of the player.
      Returns:
      The UUID of the player who earned these achievements
    • has

      boolean has(PlayerAchievement achievement)
      Returns if the player has a specific achievement.
      Parameters:
      achievement - The achievement that we want to check
      Returns:
      true if he has earned the achievement
    • earn

      default boolean earn(PlayerAchievement achievement)
      Will give the achievement to the player. Also displays a chat message that he earned if he's online.

      The operation might fail when the player already has the achievement or a plugin cancelled it via the PlayerEarnAchievementEvent. Additionally, prizers may be disabled within an arena (Arena.isPrizeForMatchEnabled()).

      Parameters:
      achievement - The achievmeent that he shall earn
      Returns:
      true when the operation was successful
      Throws:
      IllegalArgumentException - When the id of the achievement doesn't fit the format
    • earn

      boolean earn(PlayerAchievement achievement, boolean silent)
      Will give the achievement to the player. Also displays a chat message that he earned if he's online and when silent is true.

      The operation might fail when the player already has the achievement or a plugin cancelled it via the PlayerEarnAchievementEvent. Additionally, prizers may be disabled within an arena (Arena.isPrizeForMatchEnabled()).

      Parameters:
      achievement - The achievmeent that he shall earn
      silent - If it should notify the player or not
      Returns:
      true when the operation was successful
      Throws:
      IllegalArgumentException - When the id of the achievement doesn't fit the format
    • remove

      boolean remove(PlayerAchievement achievement)
      Removes the achievement from the earned list.
      Parameters:
      achievement - The achievement that he once earned
      Returns:
      false if he hasn't earned it. Otherwise true
    • getEarnDate

      @Nullable @Nullable OffsetDateTime getEarnDate(PlayerAchievement achievement)
      Returns the date when he earned the achievement.
      Parameters:
      achievement - The achievement
      Returns:
      The date when he earned it. Null if he never earned it before
    • setEarnDate

      boolean setEarnDate(PlayerAchievement achievement, OffsetDateTime date)
      Sets the earn date of the achievement.
      Parameters:
      achievement - The achievement
      date - The new date
      Returns:
      false if he never earned the achievement before
    • getEarnedIds

      Set<String> getEarnedIds()
      Returns the ids of all achievements that he earned.
      Returns:
      The id of all earned achievements
    • save

      default void save()
      Asynchronously saves these achievements.

      It's usually not needed to call this method when the player is currently on the server as the plugin will already handle it.

    • save

      void save(@Nullable @Nullable Runnable callback)
      Asynchronously saves these achievements.

      It's usually not needed to call this method when the player is currently on the server as the plugin will already handle it. Important: The callback doesn't get synced to the main thread.

      Parameters:
      callback - Gets called when the operation was finished