Package net.luckperms.api.track
Interface Track
public interface Track
An ordered chain of
Groups.-
Method Summary
Modifier and TypeMethodDescriptionappendGroup(@NonNull Group group) Appends a group to the end of this trackvoidClear 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 trackdemote(@NonNull User user, @NonNull ContextSet contextSet) Demotes the given user along this track.Gets a list of the groups on this trackgetName()Gets the name of this trackGets the next group on the track, after the one providedgetPrevious(@NonNull Group current) Gets the previous group on the track, before the one providedinsertGroup(@NonNull Group group, int position) Inserts a group at a certain position on this trackpromote(@NonNull User user, @NonNull ContextSet contextSet) Promotes the given user along this track.removeGroup(@NonNull String group) Removes a group from this trackremoveGroup(@NonNull Group group) Removes a group from this track
-
Method Details
-
getName
Gets the name of this track- Returns:
- the name of this track
-
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
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
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
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
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
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
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
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
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
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
-