mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2025-01-06 08:18:42 +01:00
Minor adjustments to code
This commit is contained in:
parent
4e3ebc4af8
commit
649006e1ef
@ -225,7 +225,7 @@ public class ChallengesManager {
|
|||||||
int total = challengeMap.values().size();
|
int total = challengeMap.values().size();
|
||||||
int waiverAmount = en.getKey().getWaiveramount();
|
int waiverAmount = en.getKey().getWaiveramount();
|
||||||
int challengesDone = (int) en.getValue().stream().filter(ch -> pd.isChallengeDone(world, ch.getUniqueId())).count();
|
int challengesDone = (int) en.getValue().stream().filter(ch -> pd.isChallengeDone(world, ch.getUniqueId())).count();
|
||||||
int challsToDo = Math.max(0,total-challengesDone-waiverAmount);
|
int challsToDo = Math.max(0,total - challengesDone - waiverAmount);
|
||||||
boolean complete = challsToDo > 0 ? false : true;
|
boolean complete = challsToDo > 0 ? false : true;
|
||||||
// Create result class with the data
|
// Create result class with the data
|
||||||
result.add(new LevelStatus(en.getKey(), previousLevel, challsToDo, complete, isUnlocked));
|
result.add(new LevelStatus(en.getKey(), previousLevel, challsToDo, complete, isUnlocked));
|
||||||
|
@ -3,7 +3,6 @@ package bentobox.addon.challenges.panel;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -47,6 +46,7 @@ public class ChallengesPanels2 {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (level.isEmpty()) {
|
if (level.isEmpty()) {
|
||||||
|
// TODO: open the furthest challenge panel
|
||||||
level = manager.getChallengeList().keySet().iterator().next().getUniqueId();
|
level = manager.getChallengeList().keySet().iterator().next().getUniqueId();
|
||||||
}
|
}
|
||||||
this.level = level;
|
this.level = level;
|
||||||
@ -67,9 +67,8 @@ public class ChallengesPanels2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addChallengeItems(PanelBuilder panelBuilder) {
|
private void addChallengeItems(PanelBuilder panelBuilder) {
|
||||||
Set<Challenges> levelChallenges = manager.getChallenges(level, world);
|
|
||||||
// Only show a control panel for the level requested.
|
// Only show a control panel for the level requested.
|
||||||
for (Challenges challenge : levelChallenges) {
|
for (Challenges challenge : manager.getChallenges(level, world)) {
|
||||||
createItem(panelBuilder, challenge);
|
createItem(panelBuilder, challenge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,7 +126,7 @@ public class ChallengesPanels2 {
|
|||||||
private void addNavigation(PanelBuilder panelBuilder) {
|
private void addNavigation(PanelBuilder panelBuilder) {
|
||||||
// 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().equalsIgnoreCase(level)) {
|
||||||
// Skip if this is the current level
|
// Skip if this is the current level
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user