Skip to content

Commit

Permalink
Fix a bug with challenge deletion.
Browse files Browse the repository at this point in the history
If challenge has been left in a level, then system did not remove challenge from it and was kept as ghost challenge, preventing from completing level.
  • Loading branch information
BONNe committed Nov 3, 2019
1 parent 9d45f08 commit e3e3191
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/main/java/world/bentobox/challenges/ChallengesManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1669,11 +1669,22 @@ public void deleteChallenge(Challenge challenge)
{
if (this.challengeCacheData.containsKey(challenge.getUniqueId()))
{
// First remove challenge from its owner level.

if (!challenge.getLevel().equals(FREE))
{
ChallengeLevel level = this.getLevel(challenge.getLevel());

if (level != null)
{
this.removeChallengeFromLevel(challenge, level);
}
}

// Afterwards remove challenge from the database.

this.challengeCacheData.remove(challenge.getUniqueId());
this.challengeDatabase.deleteObject(challenge);

this.addon.getPlugin().getPlaceholdersManager().
unregisterPlaceholder("challenges_challenge_repetition_count_" + challenge.getUniqueId());
}
}

Expand Down

0 comments on commit e3e3191

Please sign in to comment.