Skip to content

Commit

Permalink
Release 0.8.3
Browse files Browse the repository at this point in the history
# Conflicts:
#	pom.xml
  • Loading branch information
BONNe committed Jul 9, 2020
2 parents 4caeee6 + 15655b8 commit 8802780
Show file tree
Hide file tree
Showing 19 changed files with 402 additions and 108 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ Add-on for BentoBox to provide challenges for any BentoBox GameMode.
## Where to find

Currently Challenges Addon is in **Beta stage**, so it may or may not contain bugs... a lot of bugs. Also it means, that some features are not working or implemented.
Latest official **Beta Release is 0.8.1**, and you can download it from [Release tab](https://github.com/BentoBoxWorld/Challenges/releases)
But it will work with BentoBox 1.6.x and BentoBox 1.7.x.
Latest official **Beta Release is 0.8.3**, and you can download it from [Release tab](https://github.com/BentoBoxWorld/Challenges/releases)
But it will work with BentoBox 1.14.

Latest development builds will be based on **Minecraft 1.14.4** and **BentoBox 1.8.0**.
Latest development builds will be based on **Minecraft 1.16.1** and **BentoBox 1.14.0**.
**Nightly builds** are available in [Jenkins Server](https://ci.codemc.org/job/BentoBoxWorld/job/Challenges/lastStableBuild/).

Be aware that 0.8.0 stores data differently than it is in 0.7.5 and below. It will be necessary to migrate data via command `/[gamemode_admin] challenges migrate`.

If you like this addon but something is missing or is not working as you want, you can always submit an [Issue request](https://github.com/BentoBoxWorld/Challenges/issues) or get a support in Discord [BentoBox ![icon](https://avatars2.githubusercontent.com/u/41555324?s=15&v=4)](https://discord.bentobox.world)

## Translations
Expand All @@ -38,12 +36,12 @@ There exist also Web Library, where users can download public challenges. It is

## Compatibility

- [x] BentoBox - 1.6.x and 1.7.x versions
- [x] BentoBox - 1.14 versions
- [x] BSkyBlock
- [x] AcidIsland
- [x] SkyGrid
- [x] CaveBlock

## Information

More information can be found in [Wiki Pages](https://github.com/BentoBoxWorld/Challenges/wiki).
More information can be found in [Wiki Pages](https://docs.bentobox.world/addons/Challenges/).
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
<java.version>1.8</java.version>
<powermock.version>2.0.2</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.14.4-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.7.0</bentobox.version>
<spigot.version>1.15.2-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.14.0</bentobox.version>
<level.version>1.6.0</level.version>
<vault.version>1.7</vault.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- This allows to change between versions and snapshots. -->
<build.version>0.8.2</build.version>
<build.version>0.8.3</build.version>
<build.number>-LOCAL</build.number>
</properties>

Expand Down
97 changes: 97 additions & 0 deletions src/main/java/world/bentobox/challenges/ChallengesAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ public void onEnable() {
CHALLENGES_ISLAND_PROTECTION.addGameModeAddon(gameModeAddon);

this.registerPlaceholders(gameModeAddon);

// TODO: this is old placeholders. Remove when backward compatibility ends.
this.registerPlaceholdersOld(gameModeAddon);
}
});

Expand Down Expand Up @@ -283,7 +286,14 @@ public void onDisable() {
if (this.hooked) {
this.challengesManager.save();
}
}


/**
* This method saves addon settings into file.
*/
public void saveSettings()
{
if (this.settings != null)
{
new Config<>(this, Settings.class).saveConfigObject(this.settings);
Expand Down Expand Up @@ -320,6 +330,93 @@ private boolean isInCompatibleDatabase()
* @param gameModeAddon GameMode addon where placeholders must be hooked in.
*/
private void registerPlaceholders(GameModeAddon gameModeAddon)
{
final String addonName = this.getDescription().getName().toLowerCase();
final World world = gameModeAddon.getOverWorld();

// Number of completions for all challenges placeholder
this.getPlugin().getPlaceholdersManager().registerPlaceholder(gameModeAddon,
addonName + "_total_completion_count",
user -> String.valueOf(this.challengesManager.getTotalChallengeCompletionCount(user, world)));

// Completed challenge count placeholder
this.getPlugin().getPlaceholdersManager().registerPlaceholder(gameModeAddon,
addonName + "_completed_count",
user -> String.valueOf(this.challengesManager.getCompletedChallengeCount(user, world)));

// Uncompleted challenge count placeholder
this.getPlugin().getPlaceholdersManager().registerPlaceholder(gameModeAddon,
addonName + "_uncompleted_count",
user -> String.valueOf(this.challengesManager.getChallengeCount(world) -
this.challengesManager.getCompletedChallengeCount(user, world)));

// Completed challenge level count placeholder
this.getPlugin().getPlaceholdersManager().registerPlaceholder(gameModeAddon,
addonName + "_completed_level_count",
user -> String.valueOf(this.challengesManager.getCompletedLevelCount(user, world)));

// Uncompleted challenge level count placeholder
this.getPlugin().getPlaceholdersManager().registerPlaceholder(gameModeAddon,
addonName + "_uncompleted_level_count",
user -> String.valueOf(this.challengesManager.getLevelCount(world) -
this.challengesManager.getCompletedLevelCount(user, world)));

// Unlocked challenge level count placeholder
this.getPlugin().getPlaceholdersManager().registerPlaceholder(gameModeAddon,
addonName + "_unlocked_level_count",
user -> String.valueOf(this.challengesManager.getLevelCount(world) -
this.challengesManager.getUnlockedLevelCount(user, world)));

// Locked challenge level count placeholder
this.getPlugin().getPlaceholdersManager().registerPlaceholder(gameModeAddon,
addonName + "_locked_level_count",
user -> String.valueOf(this.challengesManager.getLevelCount(world) -
this.challengesManager.getUnlockedLevelCount(user, world)));

// Latest challenge level name placeholder
this.getPlugin().getPlaceholdersManager().registerPlaceholder(gameModeAddon,
addonName + "_latest_level_name",
user -> {
ChallengeLevel level = this.challengesManager.getLatestUnlockedLevel(user, world);
return level != null ? level.getFriendlyName() : "";
});

// Latest challenge level id placeholder
this.getPlugin().getPlaceholdersManager().registerPlaceholder(gameModeAddon,
addonName + "_latest_level_id",
user -> {
ChallengeLevel level = this.challengesManager.getLatestUnlockedLevel(user, world);
return level != null ? level.getUniqueId() : "";
});

// Completed challenge count in latest level
this.getPlugin().getPlaceholdersManager().registerPlaceholder(gameModeAddon,
addonName + "_latest_level_completed_count",
user -> {
ChallengeLevel level = this.challengesManager.getLatestUnlockedLevel(user, world);
return String.valueOf(level != null ?
this.challengesManager.getLevelCompletedChallengeCount(user, world, level) : 0);
});

// Uncompleted challenge count in latest level
this.getPlugin().getPlaceholdersManager().registerPlaceholder(gameModeAddon,
addonName + "_latest_level_uncompleted_count",
user -> {
ChallengeLevel level = this.challengesManager.getLatestUnlockedLevel(user, world);
return String.valueOf(level != null ?
level.getChallenges().size() - this.challengesManager.getLevelCompletedChallengeCount(user, world, level) : 0);
});
}


/**
* This method registers placeholders into GameMode addon.
* @param gameModeAddon GameMode addon where placeholders must be hooked in.
* @since 0.8.1
* @deprecated remove after 0.9.0
*/
@Deprecated
private void registerPlaceholdersOld(GameModeAddon gameModeAddon)
{
final String gameMode = gameModeAddon.getDescription().getName().toLowerCase();
final World world = gameModeAddon.getOverWorld();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public boolean loadDefaultChallenges(User user, World world)
return false;
}

this.addon.getChallengesManager().save();
this.addon.getChallengesManager().saveChallenges();
this.addon.getChallengesManager().saveLevels();

if (removeAtEnd)
{
Expand Down Expand Up @@ -203,7 +204,8 @@ public boolean loadDownloadedChallenges(User user, World world, String downloadS
return false;
}

this.addon.getChallengesManager().save();
this.addon.getChallengesManager().saveChallenges();
this.addon.getChallengesManager().saveLevels();

return true;
}
Expand Down
Loading

0 comments on commit 8802780

Please sign in to comment.