diff --git a/src/main/java/world/bentobox/challenges/panel/TryToComplete.java b/src/main/java/world/bentobox/challenges/panel/TryToComplete.java index ceffdba..3107f84 100644 --- a/src/main/java/world/bentobox/challenges/panel/TryToComplete.java +++ b/src/main/java/world/bentobox/challenges/panel/TryToComplete.java @@ -764,23 +764,39 @@ public class TryToComplete */ private ChallengeResult checkOthers() { - if (!this.addon.isEconomyProvided() || - this.challenge.getRequiredMoney() <= 0 || - !this.addon.getEconomyProvider().has(this.user, this.challenge.getRequiredMoney())) + if (!this.addon.isLevelProvided() && + this.challenge.getRequiredIslandLevel() != 0) + { + this.user.sendMessage("challenges.missing-addon"); + } + else if (!this.addon.isEconomyProvided() && + this.challenge.getRequiredMoney() != 0) + { + this.user.sendMessage("challenges.missing-addon"); + } + else if (this.addon.isEconomyProvided() && this.challenge.getRequiredMoney() < 0) + { + this.user.sendMessage("challenges.incorrect"); + } + else if (this.addon.isEconomyProvided() && + !this.addon.getEconomyProvider().has(this.user, this.challenge.getRequiredMoney())) { this.user.sendMessage("challenges.not-enough-money", "[money]", Integer.toString(this.challenge.getRequiredMoney())); } - else if (this.challenge.getRequiredExperience() <= 0 || - this.user.getPlayer().getTotalExperience() < this.challenge.getRequiredExperience()) + else if (this.challenge.getRequiredExperience() < 0) + { + this.user.sendMessage("challenges.incorrect"); + } + else if (this.user.getPlayer().getTotalExperience() < this.challenge.getRequiredExperience()) { this.user.sendMessage("challenges.not-enough-exp", "[xp]", Integer.toString(this.challenge.getRequiredExperience())); } - else if (!this.addon.isLevelProvided() || - this.addon.getLevelAddon().getIslandLevel(this.world, this.user.getUniqueId()) < this.challenge.getRequiredIslandLevel()) + else if (this.addon.isLevelProvided() && + this.addon.getLevelAddon().getIslandLevel(this.world, this.user.getUniqueId()) < this.challenge.getRequiredIslandLevel()) { this.user.sendMessage("challenges.error.island-level", TextVariables.NUMBER, diff --git a/src/main/resources/locales/en-US.yml b/src/main/resources/locales/en-US.yml index 245f3c2..6339716 100755 --- a/src/main/resources/locales/en-US.yml +++ b/src/main/resources/locales/en-US.yml @@ -218,3 +218,5 @@ challenges: you-completed: You completed the [challenge] challenge! you-completed-level: Congratulations, you complete [level]! you-repeated: You repeated the [challenge] challenge! + missing-addon: It is not possible to complete challenge. Plugin or addon is missing. + incorrect: Current challenge is corupted.