Skip to content

Commit 3b76fe4

Browse files
Merge pull request #62 from ParallelMC/staging
Staging
2 parents bca409a + 143e915 commit 3b76fe4

File tree

6 files changed

+44
-10
lines changed

6 files changed

+44
-10
lines changed

api/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77

88
group = 'org.parallelmc'
99

10-
version = '4.1.0'
10+
version = '4.1.1'
1111
description = 'A set of utilities and features for use on the Parallel Minecraft server'
1212

1313
java {
@@ -28,7 +28,7 @@ dependencies {
2828
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.8'
2929
implementation 'mysql:mysql-connector-java:8.0.33'
3030
compileOnly 'com.comphenix.protocol:ProtocolLib:5.0.0'
31-
compileOnly 'dev.esophose:playerparticles:8.2'
31+
compileOnly 'dev.esophose:playerparticles:8.4'
3232
implementation 'org.reflections:reflections:0.10.2'
3333
}
3434

api/src/main/java/parallelmc/parallelutils/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class Constants {
44

5-
public static final Version VERSION = new Version(4, 1, 0);
5+
public static final Version VERSION = new Version(4, 1, 1);
66
public static final String PLUGIN_NAME = "ParallelUtils";
77
public static final String DEFAULT_WORLD = "world2";
88
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ allprojects {
4343

4444
compileOnly "io.papermc.paper:paper-api:1.20-R0.1-SNAPSHOT"
4545
compileOnly 'net.luckperms:api:5.4'
46-
compileOnly 'dev.esophose:playerparticles:8.2'
46+
compileOnly 'dev.esophose:playerparticles:8.4'
4747
}
4848
}

modules/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies {
2525
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.8'
2626
compileOnly 'mysql:mysql-connector-java:8.0.33'
2727
compileOnly 'com.comphenix.protocol:ProtocolLib:5.0.0'
28-
compileOnly 'dev.esophose:playerparticles:8.2'
28+
compileOnly 'dev.esophose:playerparticles:8.4'
2929
}
3030

3131
def names = []

modules/src/main/java/parallelmc/parallelutils/modules/parallelchat/gui/JoinLeaveSelectInventory.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
import parallelmc.parallelutils.modules.parallelchat.messages.JoinLeaveMessage;
1818
import parallelmc.parallelutils.util.GUIInventory;
1919

20-
import java.util.ArrayList;
21-
import java.util.HashMap;
22-
import java.util.List;
23-
import java.util.Map;
20+
import java.util.*;
2421
import java.util.logging.Level;
2522

2623
public class JoinLeaveSelectInventory extends GUIInventory {
@@ -69,7 +66,8 @@ public void onOpen(Player player) {
6966
selected = ParallelChat.get().customMessageManager.getJoinMessageNameForPlayer(player);
7067
else
7168
selected = ParallelChat.get().customMessageManager.getLeaveMessageNameForPlayer(player);
72-
for (Map.Entry<String, JoinLeaveMessage> m : messages.entrySet().stream().filter(x -> x.getValue().event().equalsIgnoreCase(EVENT)).toList()) {
69+
for (Map.Entry<String, JoinLeaveMessage> m :
70+
messages.entrySet().stream().filter(x -> x.getValue().event().equalsIgnoreCase(EVENT)).sorted(new RankComparator()).toList()) {
7371
ItemStack item = new ItemStack(Material.PAPER);
7472
ItemMeta meta = item.getItemMeta();
7573
JoinLeaveMessage msg = m.getValue();
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package parallelmc.parallelutils.modules.parallelchat.gui;
2+
3+
import parallelmc.parallelutils.modules.parallelchat.messages.JoinLeaveMessage;
4+
5+
import java.util.Comparator;
6+
import java.util.Map;
7+
8+
/***
9+
* Helper class for sorting the items by rank in the JoinLeaveSelectInventory
10+
*/
11+
public class RankComparator implements Comparator<Map.Entry<String, JoinLeaveMessage>> {
12+
@Override
13+
public int compare(Map.Entry<String, JoinLeaveMessage> entry1, Map.Entry<String, JoinLeaveMessage> entry2) {
14+
return Integer.compare(rankValue(entry1), rankValue(entry2));
15+
}
16+
17+
private int rankValue(Map.Entry<String, JoinLeaveMessage> entry) {
18+
return switch (entry.getValue().requiredRank().toLowerCase()) {
19+
case "recruit" -> 1;
20+
case "cadet" -> 2;
21+
case "researcher" -> 3;
22+
case "adventurer" -> 4;
23+
case "voyager" -> 5;
24+
case "rift_master" -> 6;
25+
case "bronze" -> 7;
26+
case "silver" -> 8;
27+
case "gold" -> 9;
28+
case "diamond" -> 10;
29+
case "team" -> 11;
30+
case "mod" -> 12;
31+
case "admin" -> 13;
32+
case "owner" -> 14;
33+
default -> Integer.MAX_VALUE;
34+
};
35+
}
36+
}

0 commit comments

Comments
 (0)