Skip to content

Commit

Permalink
Rankup: would not work for ladders other than default and prestiges. …
Browse files Browse the repository at this point in the history
…Fixed.
  • Loading branch information
rbluer committed Oct 11, 2024
1 parent be90233 commit db08871
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
3 changes: 3 additions & 0 deletions docs/changelog_v3.3.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.**


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public void rankUp(CommandSender sender,
);


if ( isDefaultBypassPermCheck ||
; if ( isDefaultBypassPermCheck ||
isPrestigeBypassPermCheck ||

isLadderDefault && hasDefaultPerm ||
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit db08871

Please sign in to comment.