Challenges can only be done in the world that they belong.

https://github.com/BentoBoxWorld/addon-challenges/issues/24
This commit is contained in:
tastybento 2018-11-23 16:40:06 -08:00
parent edc2c455c4
commit 97bec0f870
1 changed files with 5 additions and 0 deletions

View File

@ -184,6 +184,11 @@ public class TryToComplete {
* 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");