Package net.luckperms.api.track
Interface Track
-
public interface TrackAn ordered chain ofGroups.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NonNull DataMutateResultappendGroup(@NonNull Group group)Appends a group to the end of this trackvoidclearGroups()Clear all of the groups from this trackbooleancontainsGroup(@NonNull String group)Checks if a group features on this trackbooleancontainsGroup(@NonNull Group group)Checks if a group features on this track@NonNull DemotionResultdemote(@NonNull User user, @NonNull ContextSet contextSet)Demotes the given user along this track.@NonNull @Unmodifiable List<String>getGroups()Gets a list of the groups on this track@NonNull StringgetName()Gets the name of this track@Nullable StringgetNext(@NonNull Group current)Gets the next group on the track, after the one provided@Nullable StringgetPrevious(@NonNull Group current)Gets the previous group on the track, before the one provided@NonNull DataMutateResultinsertGroup(@NonNull Group group, int position)Inserts a group at a certain position on this track@NonNull PromotionResultpromote(@NonNull User user, @NonNull ContextSet contextSet)Promotes the given user along this track.@NonNull DataMutateResultremoveGroup(@NonNull String group)Removes a group from this track@NonNull DataMutateResultremoveGroup(@NonNull Group group)Removes a group from this track
-
-
-
Method Detail
-
getGroups
@NonNull @Unmodifiable List<String> getGroups()
Gets a list of the groups on this trackIndex 0 is the first/lowest group in (or start of) the track.
The returned collection is immutable, and cannot be modified.
- Returns:
- an ordered
Listof the groups on this track
-
getNext
@Nullable String getNext(@NonNull Group current)
Gets the next group on the track, after the one providednullis returned if the group is not on the track.- Parameters:
current- the group before the group being requested- Returns:
- the group name, or null if the end of the track has been reached
- Throws:
NullPointerException- if the group is nullIllegalStateException- if the group instance was not obtained from LuckPerms.
-
getPrevious
@Nullable String getPrevious(@NonNull Group current)
Gets the previous group on the track, before the one providednullis returned if the group is not on the track.- Parameters:
current- the group after the group being requested- Returns:
- the group name, or null if the start of the track has been reached
- Throws:
NullPointerException- if the group is nullIllegalStateException- if the group instance was not obtained from LuckPerms.
-
promote
@NonNull PromotionResult promote(@NonNull User user, @NonNull ContextSet contextSet)
Promotes the given user along this track.- Parameters:
user- the user to promotecontextSet- the contexts to promote the user in- Returns:
- the result of the action
-
demote
@NonNull DemotionResult demote(@NonNull User user, @NonNull ContextSet contextSet)
Demotes the given user along this track.- Parameters:
user- the user to demotecontextSet- the contexts to demote the user in- Returns:
- the result of the action
-
appendGroup
@NonNull DataMutateResult appendGroup(@NonNull Group group)
Appends a group to the end of this track- Parameters:
group- the group to append- Returns:
- the result of the operation
- Throws:
NullPointerException- if the group is nullIllegalStateException- if the group instance was not obtained from LuckPerms.
-
insertGroup
@NonNull DataMutateResult insertGroup(@NonNull Group group, int position) throws IndexOutOfBoundsException
Inserts a group at a certain position on this track- Parameters:
group- the group to be insertedposition- the index position (a value of 0 inserts at the start)- Returns:
- the result of the operation
- Throws:
IndexOutOfBoundsException- if the position is less than 0 or greater than the size of the trackNullPointerException- if the group is nullIllegalStateException- if the group instance was not obtained from LuckPerms.
-
removeGroup
@NonNull DataMutateResult removeGroup(@NonNull Group group)
Removes a group from this track- Parameters:
group- the group to remove- Returns:
- the result of the operation
- Throws:
NullPointerException- if the group is nullIllegalStateException- if the group instance was not obtained from LuckPerms.
-
removeGroup
@NonNull DataMutateResult removeGroup(@NonNull String group)
Removes a group from this track- Parameters:
group- the group to remove- Returns:
- the result of the operation
- Throws:
NullPointerException- if the group is null
-
containsGroup
boolean containsGroup(@NonNull Group group)
Checks if a group features on this track- Parameters:
group- the group to check- Returns:
- true if the group is on this track
- Throws:
NullPointerException- if the group is nullIllegalStateException- if the group instance was not obtained from LuckPerms.
-
containsGroup
boolean containsGroup(@NonNull String group)
Checks if a group features on this track- Parameters:
group- the group to check- Returns:
- true if the group is on this track
- Throws:
NullPointerException- if the group is null
-
clearGroups
void clearGroups()
Clear all of the groups from this track
-
-