From ca5ff504f0a737c53065edc901f0704eb1136833 Mon Sep 17 00:00:00 2001 From: BONNe Date: Sun, 16 Jun 2019 20:46:12 +0300 Subject: [PATCH] Add protection code in TryToComplete task, to avoid negative numbers in max completion times. --- .../java/world/bentobox/challenges/tasks/TryToComplete.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/world/bentobox/challenges/tasks/TryToComplete.java b/src/main/java/world/bentobox/challenges/tasks/TryToComplete.java index f76e513..ee1aaed 100644 --- a/src/main/java/world/bentobox/challenges/tasks/TryToComplete.java +++ b/src/main/java/world/bentobox/challenges/tasks/TryToComplete.java @@ -510,6 +510,11 @@ public class TryToComplete this.user.sendMessage("challenges.errors.not-deployed"); 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()) || !this.challenge.getUniqueId().startsWith(Util.getWorld(this.world).getName())) {