From db088716fdb1d714e089ce2aaaf228dd1faaf23c Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Fri, 11 Oct 2024 12:52:45 -0400 Subject: [PATCH] Rankup: would not work for ladders other than default and prestiges. Fixed. --- docs/changelog_v3.3.x.md | 3 ++ .../prison/ranks/commands/RankUpCommand.java | 31 ++++++++++++------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 3f2aa3676..36afc4304 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -17,6 +17,9 @@ These change logs represent the work that has been going on within prison. # 3.3.0-alpha.19d 2024-10-11 +* **Rankup: would not work for ladders other than default and prestiges. Fixed.** + + * **Update xseries to v11.3.0 from v11.2.1.** diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RankUpCommand.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RankUpCommand.java index 42161c4a0..c788a122b 100644 --- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RankUpCommand.java +++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RankUpCommand.java @@ -261,7 +261,7 @@ public void rankUp(CommandSender sender, ); - if ( isDefaultBypassPermCheck || +; if ( isDefaultBypassPermCheck || isPrestigeBypassPermCheck || isLadderDefault && hasDefaultPerm || @@ -592,25 +592,34 @@ private boolean rankUpPrivate(CommandSender sender, String playerName, String la // Get the player's next rank on default ladder, or if at end then it will return the next // prestiges rank. - PlayerRank playerRankTarget = rankPlayer.getNextPlayerRank(); + PlayerRank playerRankTarget = null; - - // If the nextRank is null or the ladder does not match selected ladder, then exit: - if ( playerRankTarget == null || playerRankTarget.getRank() == null || - !playerRankTarget.getRank().getLadder().getName().equalsIgnoreCase( ladder ) ) { + if ( targetLadder.isDefault() || targetLadder.isPrestiges() ) { - return false; + playerRankTarget = rankPlayer.getNextPlayerRank(); + + // If the nextRank is null or the ladder does not match selected ladder, then exit: + if ( playerRankTarget == null || playerRankTarget.getRank() == null ) { + + if ( Output.get().isDebug() ) { + Output.get().logInfo( + "RankUp ladder= %s currentRank= %s " + + "No next default or prestige rank. At end of both ladders?", + ladder, rankCurrent.getRank().getName() ); + } + + return false; + } } + RankPlayerFactory rankPlayerFactory = new RankPlayerFactory(); - // If the target ladder is either default or prestiges, then use the getNextPlayerRank() value - // that is provided. Only use the following code if not these two ladders. - if ( !ladder.equalsIgnoreCase( LadderManager.LADDER_DEFAULT ) && - !ladder.equalsIgnoreCase( LadderManager.LADDER_PRESTIGES ) ) { + // If ranking up on neither default or prestige ladders: + if ( !targetLadder.isDefault() && !targetLadder.isPrestiges() ) { PlayerRank playerRankCurrent = rankPlayerFactory.getRank( rankPlayer, ladder );