Interface Track


public interface Track
An ordered chain of Groups.
  • Method Details

    • getName

      @NonNull String getName()
      Gets the name of this track
      Returns:
      the name of this track
    • getGroups

      Gets a list of the groups on this track

      Index 0 is the first/lowest group in (or start of) the track.

      The returned collection is immutable, and cannot be modified.

      Returns:
      an ordered List of the groups on this track
    • getNext

      @Nullable String getNext(@NonNull Group current)
      Gets the next group on the track, after the one provided

      null is 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 null
      IllegalStateException - 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 provided

      null is 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 null
      IllegalStateException - if the group instance was not obtained from LuckPerms.
    • promote

      Promotes the given user along this track.
      Parameters:
      user - the user to promote
      contextSet - 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 demote
      contextSet - 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 null
      IllegalStateException - 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 inserted
      position - 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 track
      NullPointerException - if the group is null
      IllegalStateException - 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
      IllegalStateException - 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

      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 null
      IllegalStateException - 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