Class CompletionCriteria
java.lang.Object
me.gamercoder215.starcosmetics.api.CompletionCriteria
Represents Criteria needed to unlock a Cosmetic
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CompletionCriteriaRepresents a CompletionCriteria that requires nothing. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic CompletionCriteriafromBlocksMined(int amount) Generates a CompletionCriteria from the amount of blocks mined.static @NotNull CompletionCriteriafromCompletion(@NotNull Completion completion) Generates a CompletionCriteria from aCompletion.static CompletionCriteriafromCrafted(int amount, Collection<Material> materials) Generates a CompletionCriteria withStatistic.CRAFT_ITEM, using multiple.static CompletionCriteriafromCrafted(int amount, Material m) Generates a CompletionCriteria withStatistic.CRAFT_ITEM.static CompletionCriteriafromCrafted(int amount, Material... materials) Generates a CompletionCriteria withStatistic.CRAFT_ITEM, using multiple.static @NotNull CompletionCriteriafromDistance(Statistic stat, double cm) Generates a CompletionCriteria from a distance statistic (e.g.static CompletionCriteriafromKilled(int amount, EntityType type) Generates a CompletionCriteria withStatistic.KILL_ENTITY.static @NotNull CompletionCriteriafromMined(int amount, Collection<Material> materials) Generates a CompletionCriteria withStatistic.MINE_BLOCK, using multiple.static @NotNull CompletionCriteriaGenerates a CompletionCriteria withStatistic.MINE_BLOCK.static CompletionCriteriaGenerates a CompletionCriteria withStatistic.MINE_BLOCK, using multiple.static @NotNull CompletionCriteriafromPermission(String permission) Generates a CompletionCriteria with the given permission.static @NotNull CompletionCriteriafromPlaytime(long ticks) Generates a CompletionCrtieria with the player's playtime.static @NotNull CompletionCriteriafromSelectionLimit(int limit) Constructs a CompletionCriteria required to have the given selection limit.static CompletionCriteriafromStatistic(Statistic stat, int amount) Generates a CompletionCriteria with a BukkitStatistic.Fetches the criteria needed to unlock a Cosmetic.@NotNull StringFetches the display message of this criteria.doublegetProgressPercentage(@NotNull Player p) Fetches the progress of a Player for this CompletionCriteria.inthashCode()booleanisUnlocked(@Nullable Player p) Whether this Player meets the criteria.toString()
-
Field Details
-
NONE
Represents a CompletionCriteria that requires nothing.
-
-
Method Details
-
getCriteria
Fetches the criteria needed to unlock a Cosmetic.- Returns:
- Predicate representing the criteria
-
isUnlocked
Whether this Player meets the criteria.- Parameters:
p- Player to check- Returns:
- true if meets criteria, else false
-
getDisplayMessage
Fetches the display message of this criteria.- Returns:
- Display Message
-
getProgressPercentage
Fetches the progress of a Player for this CompletionCriteria.- Parameters:
p- Player to fetch progress for- Returns:
- Progress Percentage
-
equals
-
hashCode
public int hashCode() -
toString
-
fromCompletion
@NotNull public static @NotNull CompletionCriteria fromCompletion(@NotNull @NotNull Completion completion) throws IllegalArgumentException Generates a CompletionCriteria from aCompletion.- Parameters:
completion- Completion to Check for- Returns:
- CompletionCriteria with the given criteria
- Throws:
IllegalArgumentException- if criteria is null
-
fromMined
Generates a CompletionCriteria withStatistic.MINE_BLOCK.- Parameters:
amount- The amount of blocks to minem- The material to check for- Returns:
- CompletionCriteria with the given criteria
-
fromDistance
Generates a CompletionCriteria from a distance statistic (e.g.Statistic.WALK_ONE_CM).- Parameters:
stat- Statistic to checkcm- The amount of centimeters to check for- Returns:
- CompletionCriteria with the given criteria
-
fromMined
@NotNull public static @NotNull CompletionCriteria fromMined(int amount, Collection<Material> materials) Generates a CompletionCriteria withStatistic.MINE_BLOCK, using multiple. Materials mined will count EITHER and amounts will not be added together.- Parameters:
amount- The amount of blocks to minematerials- Collection of Materials to check for- Returns:
- CompletionCriteria with the given criteria
-
fromMined
Generates a CompletionCriteria withStatistic.MINE_BLOCK, using multiple. Materials mined will count EITHER and amounts will not be added together.- Parameters:
amount- The amount of blocks to minematerials- Array of Materials to check for- Returns:
- CompletionCriteria with the given criteria
-
fromKilled
Generates a CompletionCriteria withStatistic.KILL_ENTITY.- Parameters:
amount- The amount of kills to check fortype- The type of entity to check for- Returns:
- CompletionCriteria with the given criteria
-
fromStatistic
Generates a CompletionCriteria with a Bukkit
Statistic.NOTE: Statistics that require addition input in
Player.getStatistic(Statistic)will not work properly.- Parameters:
stat- The statistic to check foramount- The amount of kills to check for- Returns:
- CompletionCriteria with the given criteria
-
fromBlocksMined
Generates a CompletionCriteria from the amount of blocks mined.- Parameters:
amount- Blocks Mined- Returns:
- CompletionCriteria with the given criteria
-
fromCrafted
Generates a CompletionCriteria withStatistic.CRAFT_ITEM.- Parameters:
amount- The amount of items craftedm- The material to check for- Returns:
- CompletionCriteria with the given criteria
-
fromCrafted
Generates a CompletionCriteria withStatistic.CRAFT_ITEM, using multiple. Materials crafted will count EITHER and amounts will not be added together.- Parameters:
amount- The amount of items craftedmaterials- Array of Materials to check for- Returns:
- CompletionCriteria with the given criteria
-
fromCrafted
Generates a CompletionCriteria withStatistic.CRAFT_ITEM, using multiple. Materials crafted will count EITHER and amounts will not be added together.- Parameters:
amount- The amount of items craftedmaterials- Collection of Materials to check for- Returns:
- CompletionCriteria with the given criteria
-
fromPlaytime
Generates a CompletionCrtieria with the player's playtime.- Parameters:
ticks- The amount of ticks the player must play for- Returns:
- CompletionCriteria with the given criteria
-
fromSelectionLimit
@NotNull public static @NotNull CompletionCriteria fromSelectionLimit(int limit) throws IllegalArgumentException Constructs a CompletionCriteria required to have the given selection limit.- Parameters:
limit- Selection Limit- Returns:
- CompletionCriteria based on selection limit
- Throws:
IllegalArgumentException- if the limit is not positive
-
fromPermission
Generates a CompletionCriteria with the given permission.- Parameters:
permission- Permission to check for- Returns:
- CompletionCriteria with the given criteria
-