mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-13 06:05:46 +01:00
Fix some logic issue.
Add proper logic check for invalid Other Type challenges. - If VaultHook is enabled required money should be more then 0, otherwise challenge is not valid. - If LevelAddon is exists required level should be more then 0, otherwise challenge is not valid. - If required experience is less then 0, challenge is not valid. - If Level addon is missing, nut it requires some level, then challenge is not valid. - If VaultHook is missing, nut it requires some money, then challenge is not valid.
This commit is contained in:
parent
8becd9c08b
commit
93a9490cad
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user