Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the ability to change the way members are sorted in top islands (…
- Loading branch information
1 parent
ce02e14
commit 0a424be
Showing
8 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
API/src/main/java/com/bgsoftware/superiorskyblock/api/enums/TopIslandMembersSorting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.bgsoftware.superiorskyblock.api.enums; | ||
|
||
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer; | ||
|
||
import java.util.Comparator; | ||
|
||
public enum TopIslandMembersSorting { | ||
|
||
/** | ||
* Sort members in the top-islands menu by their names. | ||
*/ | ||
NAMES, | ||
|
||
/** | ||
* Sort members in the top-islands menu by their roles. | ||
*/ | ||
ROLES; | ||
|
||
private Comparator<SuperiorPlayer> comparator = null; | ||
|
||
TopIslandMembersSorting() { | ||
} | ||
|
||
public void setComparator(Comparator<SuperiorPlayer> comparator) { | ||
if (this.comparator != null) | ||
throw new IllegalArgumentException("You cannot set a comparator after it was already been set."); | ||
|
||
this.comparator = comparator; | ||
} | ||
|
||
public Comparator<SuperiorPlayer> getComparator() { | ||
if (this.comparator == null) | ||
throw new RuntimeException(this + " was not initialized."); | ||
|
||
return comparator; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters