Merge pull request #67 from BONNe/patch-3

Fix logic issue in Other Type challenge
This commit is contained in:
tastybento 2019-01-30 12:33:45 -08:00 committed by GitHub
commit 1fa5e65a57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 7 deletions

View File

@ -764,22 +764,38 @@ public class TryToComplete
*/
private ChallengeResult checkOthers()
{
if (!this.addon.isEconomyProvided() ||
this.challenge.getRequiredMoney() <= 0 ||
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() ||
else if (this.addon.isLevelProvided() &&
this.addon.getLevelAddon().getIslandLevel(this.world, this.user.getUniqueId()) < this.challenge.getRequiredIslandLevel())
{
this.user.sendMessage("challenges.error.island-level",

View File

@ -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.