Skip to content

Commit

Permalink
Challenges can only be done in the world that they belong.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Nov 24, 2018
1 parent edc2c45 commit 97bec0f
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ public TryToComplete(ChallengesAddon addon, User user, ChallengesManager manager
* Checks if a challenge can be completed or not
*/
private ChallengeResult checkIfCanCompleteChallenge() {
// Check the world
if (!Util.getWorld(user.getWorld()).getName().equalsIgnoreCase(challenge.getWorld())) {
user.sendMessage("general.errors.wrong-world");
return new ChallengeResult();
}
// Check if user has the
if (!challenge.getLevel().equals(ChallengesManager.FREE) && !manager.isLevelUnlocked(user, challenge.getLevel(), world)) {
user.sendMessage("challenges.errors.challenge-level-not-available");
Expand Down

0 comments on commit 97bec0f

Please sign in to comment.