Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public void allLoaded()
this.log("Challenges Addon hooked into Level addon.");
}, () -> {
this.levelAddon = null;
this.levelProvided = false;
this.logWarning("Level add-on not found so level challenges will not work!");
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,11 @@ private PanelItem createBiomeRequirementButton() {
description.add(this.user.getTranslation(reference + "none"));
} else {
description.add(this.user.getTranslation(reference + Constants.TITLE_KEY));
requirements.getRequiredBiomes().forEach(biomeKey -> description.add(
this.user.getTranslation(reference + "list", "[biome]", Utils.prettifyBiome(biomeKey))));
// Sort so the biome list renders in a stable order (the underlying set is unordered).
requirements.getRequiredBiomes().stream()
.sorted(Comparator.comparing(Utils::prettifyBiome))
.forEach(biomeKey -> description.add(
this.user.getTranslation(reference + "list", "[biome]", Utils.prettifyBiome(biomeKey))));
}

description.add("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ private PanelItem createToggleUndeployedButton(@NonNull ItemTemplateRecord templ
builder.name(this.user.getTranslation(this.world, template.title()));
}

if (template.description() != null)
if (template.description() != null && !template.description().isBlank())
{
builder.description(this.user.getTranslation(this.world, template.description()));
}
Expand Down
10 changes: 6 additions & 4 deletions src/test/java/world/bentobox/challenges/ChallengesAddonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,10 @@ void testPlaceholderCompletedPercentRegistered() {

addon.onEnable();

// Verify that the completed_percent placeholder was registered
// Capture every registered placeholder name; assert the one under test is present without
// pinning the exact total (which changes whenever any placeholder is added or removed).
ArgumentCaptor<String> nameCaptor = ArgumentCaptor.forClass(String.class);
verify(phm, org.mockito.Mockito.times(13)).registerPlaceholder(any(GameModeAddon.class), nameCaptor.capture(), any());
verify(phm, org.mockito.Mockito.atLeastOnce()).registerPlaceholder(any(GameModeAddon.class), nameCaptor.capture(), any());

List<String> names = nameCaptor.getAllValues();
assertTrue(names.contains("challenges_completed_percent"),
Expand All @@ -398,9 +399,10 @@ void testPlaceholderLatestLevelCompletedPercentRegistered() {

addon.onEnable();

// Verify that the latest_level_completed_percent placeholder was registered
// Capture every registered placeholder name; assert the one under test is present without
// pinning the exact total (which changes whenever any placeholder is added or removed).
ArgumentCaptor<String> nameCaptor = ArgumentCaptor.forClass(String.class);
verify(phm, org.mockito.Mockito.times(13)).registerPlaceholder(any(GameModeAddon.class), nameCaptor.capture(), any());
verify(phm, org.mockito.Mockito.atLeastOnce()).registerPlaceholder(any(GameModeAddon.class), nameCaptor.capture(), any());

List<String> names = nameCaptor.getAllValues();
assertTrue(names.contains("challenges_latest_level_completed_percent"),
Expand Down
Loading