Add protection code in TryToComplete task, to avoid negative numbers in max completion times.

This commit is contained in:
BONNe 2019-06-16 20:46:12 +03:00
parent 4e2181f524
commit ca5ff504f0

View File

@ -510,6 +510,11 @@ public class TryToComplete
this.user.sendMessage("challenges.errors.not-deployed"); this.user.sendMessage("challenges.errors.not-deployed");
result = EMPTY_RESULT; result = EMPTY_RESULT;
} }
else if (maxTimes < 1)
{
this.user.sendMessage("challenges.errors.not-valid-integer");
result = EMPTY_RESULT;
}
else if (Util.getWorld(this.world) != Util.getWorld(this.user.getWorld()) || else if (Util.getWorld(this.world) != Util.getWorld(this.user.getWorld()) ||
!this.challenge.getUniqueId().startsWith(Util.getWorld(this.world).getName())) !this.challenge.getUniqueId().startsWith(Util.getWorld(this.world).getName()))
{ {