Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Commit e5ea1c5

Browse files
authored
Close #7 Group system (#8)
* Add new gamemode commands and update plugin descriptions This commit introduces new gamemode commands including 'gm', 'gmc', 'gms', 'gma', and 'gmsp' related to creative, survival, adventure, and spectator modes respectively. Command descriptions were added in plugin.yml file. Moreover, validations for player name were added using PlayerValidator class. Minor changes include addition of a description in pom.xml and command registerations in Loader class. * Replace 'RankColors' with 'RankUtil' and update references Developed the 'RankUtil' class by replacing 'RankColors' for more functional role. The old 'RankColors' class was deleted and references to it in chat and tablist subsystems were updated. These changes better support rank management's extended tasks and also retain the color assigning feature of the older class. * closes #7; Set permission in GamemodeAdventure and revise rank handling Add a new permission in the GamemodeAdventure command class. Additionally, revise rank handling by replacing 'RankColors' with 'RankUtil', enhancing its functional role and updating all relevant references in chat and tablist subsystems. These adjustments help manage tasks related to ranks more effectively and maintain the color-assigning function of the previous class.
1 parent ecde408 commit e5ea1c5

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/main/java/net/cherrycraft/cherrycore/chatsystem/utils/RankUtil.java

+8
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ public static int compareRanks(RankUtil rank1, RankUtil rank2) {
3737
return Integer.compare(rank1.getPriority(), rank2.getPriority());
3838
}
3939

40+
public static RankUtil fromGroupName(String groupName) {
41+
for (RankUtil rank : RankUtil.values()) {
42+
if (rank.groupName.equalsIgnoreCase(groupName)) {
43+
return rank;
44+
}
45+
}
46+
throw new IllegalArgumentException("No enum constant " + RankUtil.class.getCanonicalName() + "." + groupName);
47+
}
4048
public @Nullable Group getLPRank() {
4149
return LuckPermsProvider.get().getGroupManager().getGroup(this.groupName);
4250
}

src/main/java/net/cherrycraft/cherrycore/commands/gamemode/sepperateCommands/GamemodeAdventure.java

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
public class GamemodeAdventure extends CommandManager {
1212
public GamemodeAdventure(String commandName) {
1313
super("gma");
14+
setPermission("cherrycore.gamemode");
1415
}
1516

1617
@Override

src/main/java/net/cherrycraft/cherrycore/tablist/Tablist.java

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public void onPlayerJoin(PlayerJoinEvent event) {
7272
team.setSuffix(suffix);
7373

7474
// Update the team's display name
75+
RankUtil rankColor = RankUtil.fromGroupName(primaryGroup);
7576
RankUtil rankColor = RankUtil.valueOf(primaryGroup.toUpperCase());
7677
team.setDisplayName(rankColor.getColor());
7778
}

0 commit comments

Comments
 (0)