Class TeamProgression
java.lang.Object
com.fren_gor.ultimateAdvancementAPI.database.TeamProgression
The
TeamProgression
class stores information about a team and its advancement progressions.
TeamProgression
is used to cache team information by the caching system.
This class is thread safe.
-
Constructor Summary
ConstructorDescriptionTeamProgression
(int teamId, @NotNull UUID member) Creates a new TeamProgression for a team with one player in it.TeamProgression
(@NotNull Map<AdvancementKey, Integer> advancements, int teamId, @NotNull Collection<UUID> members) Creates a new TeamProgression for a team with more than one player in it. -
Method Summary
Modifier and TypeMethodDescriptionboolean
anyMemberMatch
(@NotNull Predicate<UUID> action) Returns whether any member of the team matches the providedPredicate
.boolean
Returns whether the provided player is part of the team.boolean
Returns whether the provided player is part of the team.boolean
boolean
everyMemberMatch
(@NotNull Predicate<UUID> action) Returns whether every member of the team matches the providedPredicate
.void
forEachMember
(@NotNull Consumer<UUID> action) Runs the providedConsumer
for each member of the team.Returns theUUID
of a team member.getAnOnlineMember
(@NotNull DatabaseManager manager) Returns an online team member, if possible.Returns a modifiable copy of the team members set.getProgression
(@NotNull Advancement advancement) Gets the progression of the provided advancement for the team.getSize()
Returns the team members count.int
Returns the team unique id.int
hashCode()
boolean
isValid()
Gets whether the current TeamProgression object is valid.boolean
noMemberMatch
(@NotNull Predicate<UUID> action) Returns whether no member of the team matches the providedPredicate
.toString()
-
Constructor Details
-
TeamProgression
Creates a new TeamProgression for a team with one player in it.Note: TeamProgression should be instantiated only by database-related classes. Any illegal instantiation will throw an
IllegalOperationException
.- Parameters:
teamId
- The team id.member
- The member of the team.- Throws:
IllegalOperationException
- If this constructor is called by a class not in thecom.fren_gor.ultimateAdvancementAPI.database
package or in one of its sub-packages.
-
TeamProgression
public TeamProgression(@NotNull @NotNull Map<AdvancementKey, Integer> advancements, int teamId, @NotNull @NotNull Collection<UUID> members) Creates a new TeamProgression for a team with more than one player in it.Note: TeamProgression should be instantiated only by database-related classes. Any illegal instantiation will throw an
IllegalOperationException
.- Parameters:
advancements
- All the advancement keys with their progression.teamId
- The team id.members
- A collection of team members.- Throws:
IllegalOperationException
- If this constructor is called by a class not in thecom.fren_gor.ultimateAdvancementAPI.database
package or in one of its sub-packages.
-
-
Method Details
-
getProgression
public @Range(from=0, to=Integer.MAX_VALUE) int getProgression(@NotNull @NotNull Advancement advancement) Gets the progression of the provided advancement for the team.- Parameters:
advancement
- The advancement.- Returns:
- The current progression of the team for the provided advancement.
-
contains
Returns whether the provided player is part of the team.- Parameters:
player
- The player.- Returns:
- Whether the provided player is part of the team.
-
contains
Returns whether the provided player is part of the team.- Parameters:
uuid
- TheUUID
of the player.- Returns:
- Whether the provided player is part of the team.
-
getMembersCopy
Returns a modifiable copy of the team members set.- Returns:
- A modifiable copy of the team members set.
-
getSize
Returns the team members count.- Returns:
- The team members count.
-
forEachMember
Runs the providedConsumer
for each member of the team.- Parameters:
action
- TheConsumer
to run for each member.
-
everyMemberMatch
-
anyMemberMatch
-
noMemberMatch
-
isValid
public boolean isValid()Gets whether the current TeamProgression object is valid. A TeamProgression object is valid if and only if it is stored into the caching system (seeDatabaseManager
).- Returns:
- Whether the current TeamProgression object is valid.
- Since:
- 1.0.2
-
getAMember
Returns theUUID
of a team member. No particular player is preferred by this operation and the returned member may change from invocation to invocation.- Returns:
- The
UUID
of a team member, ornull
if the team is empty.
-
getAnOnlineMember
Returns an online team member, if possible.- Parameters:
manager
- The database manager.- Returns:
- An online team member, or
null
if there are none.
-
toString
-
equals
-
hashCode
public int hashCode() -
getTeamId
public int getTeamId()Returns the team unique id.- Returns:
- The team unique id.
-