mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-01 06:53:37 +01:00
Merge pull request #40 from BONNe/develop
Fix issue #23 - ChallengesToDo shows wrong number.
This commit is contained in:
commit
5120a3afd3
@ -112,10 +112,14 @@ public class ChallengesPanels {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addNavigation(PanelBuilder panelBuilder) {
|
private void addNavigation(PanelBuilder panelBuilder) {
|
||||||
|
// TODO: This if fix for wrong getNumberOfChallengesStillToDo() issue. #23
|
||||||
|
LevelStatus previousStatus = null;
|
||||||
|
|
||||||
// Add navigation to other levels
|
// Add navigation to other levels
|
||||||
for (LevelStatus status: manager.getChallengeLevelStatus(user, world)) {
|
for (LevelStatus status: manager.getChallengeLevelStatus(user, world)) {
|
||||||
if (status.getLevel().getUniqueId().equals(level)) {
|
if (status.getLevel().getUniqueId().equals(level)) {
|
||||||
// Skip if this is the current level
|
// Skip if this is the current level
|
||||||
|
previousStatus = status;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Create a nice name for the level
|
// Create a nice name for the level
|
||||||
@ -140,10 +144,12 @@ public class ChallengesPanels {
|
|||||||
PanelItem item = new PanelItemBuilder()
|
PanelItem item = new PanelItemBuilder()
|
||||||
.icon(new ItemStack(Material.BOOK))
|
.icon(new ItemStack(Material.BOOK))
|
||||||
.name(name)
|
.name(name)
|
||||||
.description(manager.stringSplit(user.getTranslation("challenges.to-complete", "[challengesToDo]",String.valueOf(status.getNumberOfChallengesStillToDo()), "[thisLevel]", previousLevelName)))
|
.description(manager.stringSplit(user.getTranslation("challenges.to-complete", "[challengesToDo]",String.valueOf(previousStatus != null ? previousStatus.getNumberOfChallengesStillToDo() : ""), "[thisLevel]", previousLevelName)))
|
||||||
.build();
|
.build();
|
||||||
panelBuilder.item(item);
|
panelBuilder.item(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
previousStatus = status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,10 +167,14 @@ public class ChallengesPanels2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addNavigation(PanelBuilder panelBuilder) {
|
private void addNavigation(PanelBuilder panelBuilder) {
|
||||||
|
// TODO: This if fix for wrong getNumberOfChallengesStillToDo() issue. #23
|
||||||
|
LevelStatus previousStatus = null;
|
||||||
|
|
||||||
// Add navigation to other levels
|
// Add navigation to other levels
|
||||||
for (LevelStatus status: manager.getChallengeLevelStatus(requester, world)) {
|
for (LevelStatus status: manager.getChallengeLevelStatus(requester, world)) {
|
||||||
if (status.getLevel().getUniqueId().equalsIgnoreCase(level)) {
|
if (status.getLevel().getUniqueId().equalsIgnoreCase(level)) {
|
||||||
// Skip if this is the current level
|
// Skip if this is the current level
|
||||||
|
previousStatus = status;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Create a nice name for the level
|
// Create a nice name for the level
|
||||||
@ -195,10 +199,12 @@ public class ChallengesPanels2 {
|
|||||||
PanelItem item = new PanelItemBuilder()
|
PanelItem item = new PanelItemBuilder()
|
||||||
.icon(new ItemStack(Material.BOOK))
|
.icon(new ItemStack(Material.BOOK))
|
||||||
.name(name)
|
.name(name)
|
||||||
.description(manager.stringSplit(requester.getTranslation("challenges.to-complete", "[challengesToDo]",String.valueOf(status.getNumberOfChallengesStillToDo()), "[thisLevel]", previousLevelName)))
|
.description(manager.stringSplit(requester.getTranslation("challenges.to-complete", "[challengesToDo]",String.valueOf(previousStatus != null ? previousStatus.getNumberOfChallengesStillToDo() : ""), "[thisLevel]", previousLevelName)))
|
||||||
.build();
|
.build();
|
||||||
panelBuilder.item(item);
|
panelBuilder.item(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
previousStatus = status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user