From 97bec0f870bdc851fc6c784e8ae01a1a6cf87dea Mon Sep 17 00:00:00 2001 From: tastybento Date: Fri, 23 Nov 2018 16:40:06 -0800 Subject: [PATCH] Challenges can only be done in the world that they belong. https://github.com/BentoBoxWorld/addon-challenges/issues/24 --- .../java/bentobox/addon/challenges/panel/TryToComplete.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/bentobox/addon/challenges/panel/TryToComplete.java b/src/main/java/bentobox/addon/challenges/panel/TryToComplete.java index c4dd019..6020001 100644 --- a/src/main/java/bentobox/addon/challenges/panel/TryToComplete.java +++ b/src/main/java/bentobox/addon/challenges/panel/TryToComplete.java @@ -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");