mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-24 19:45:14 +01:00
Fixes a bug with -1
repeat-times
There was a bug that prevented the challenge to be completed if negative numbers were set in the "max-repeats" value.
This commit is contained in:
parent
48c47f086d
commit
e96e2c7e72
@ -771,7 +771,7 @@ public class TryToComplete
|
|||||||
// Challenge is not repeatable
|
// Challenge is not repeatable
|
||||||
vantedTimes = 1;
|
vantedTimes = 1;
|
||||||
}
|
}
|
||||||
else if (this.challenge.getMaxTimes() != 0)
|
else if (this.challenge.getMaxTimes() > 0)
|
||||||
{
|
{
|
||||||
// Challenge has limitations
|
// Challenge has limitations
|
||||||
long availableTimes = this.challenge.getMaxTimes() - this.manager.getChallengeTimes(this.user, this.world, this.challenge);
|
long availableTimes = this.challenge.getMaxTimes() - this.manager.getChallengeTimes(this.user, this.world, this.challenge);
|
||||||
@ -858,6 +858,11 @@ public class TryToComplete
|
|||||||
*/
|
*/
|
||||||
private ChallengeResult checkInventory(int maxTimes)
|
private ChallengeResult checkInventory(int maxTimes)
|
||||||
{
|
{
|
||||||
|
if (maxTimes <= 0)
|
||||||
|
{
|
||||||
|
return EMPTY_RESULT;
|
||||||
|
}
|
||||||
|
|
||||||
// Run through inventory
|
// Run through inventory
|
||||||
List<ItemStack> requiredItems;
|
List<ItemStack> requiredItems;
|
||||||
|
|
||||||
@ -1000,6 +1005,11 @@ public class TryToComplete
|
|||||||
*/
|
*/
|
||||||
private ChallengeResult checkSurrounding(int factor)
|
private ChallengeResult checkSurrounding(int factor)
|
||||||
{
|
{
|
||||||
|
if (factor <= 0)
|
||||||
|
{
|
||||||
|
return EMPTY_RESULT;
|
||||||
|
}
|
||||||
|
|
||||||
// Init location in player position.
|
// Init location in player position.
|
||||||
BoundingBox boundingBox = this.user.getPlayer().getBoundingBox().clone();
|
BoundingBox boundingBox = this.user.getPlayer().getBoundingBox().clone();
|
||||||
|
|
||||||
@ -1316,6 +1326,11 @@ public class TryToComplete
|
|||||||
*/
|
*/
|
||||||
private ChallengeResult checkOthers(int factor)
|
private ChallengeResult checkOthers(int factor)
|
||||||
{
|
{
|
||||||
|
if (factor <= 0)
|
||||||
|
{
|
||||||
|
return EMPTY_RESULT;
|
||||||
|
}
|
||||||
|
|
||||||
OtherRequirements requirements = this.getOtherRequirements();
|
OtherRequirements requirements = this.getOtherRequirements();
|
||||||
|
|
||||||
if (!this.addon.isLevelProvided() && requirements.getRequiredIslandLevel() != 0)
|
if (!this.addon.isLevelProvided() && requirements.getRequiredIslandLevel() != 0)
|
||||||
@ -1390,6 +1405,11 @@ public class TryToComplete
|
|||||||
*/
|
*/
|
||||||
private ChallengeResult checkStatistic(int factor)
|
private ChallengeResult checkStatistic(int factor)
|
||||||
{
|
{
|
||||||
|
if (factor <= 0)
|
||||||
|
{
|
||||||
|
return EMPTY_RESULT;
|
||||||
|
}
|
||||||
|
|
||||||
StatisticRequirements requirements = this.challenge.getRequirements();
|
StatisticRequirements requirements = this.challenge.getRequirements();
|
||||||
|
|
||||||
int currentValue;
|
int currentValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user