From 351ec5acf6e261bfd5483792e4f064340a3d1789 Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Wed, 6 May 2020 17:33:03 -0400 Subject: [PATCH] Silence error for insufficient reach location radii, fixes #1291 --- main/src/main/java/me/blackvein/quests/Quester.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/me/blackvein/quests/Quester.java b/main/src/main/java/me/blackvein/quests/Quester.java index d4bf7515f..b0cda8aec 100644 --- a/main/src/main/java/me/blackvein/quests/Quester.java +++ b/main/src/main/java/me/blackvein/quests/Quester.java @@ -2152,6 +2152,9 @@ public class Quester { if (getCurrentStage(quest).radiiToReachWithin.size() <= index) { return; } + if (getQuestData(quest).radiiToReachWithin.size() <= index) { + return; + } Location locationToReach = getCurrentStage(quest).locationsToReach.get(index); double radius = getQuestData(quest).radiiToReachWithin.get(index); if (l.getX() < (locationToReach.getX() + radius) && l.getX() > (locationToReach.getX() - radius)) { @@ -2160,7 +2163,7 @@ public class Quester { > (locationToReach.getY() - radius)) { if (l.getWorld().getName().equals(locationToReach.getWorld().getName())) { // TODO - Find proper cause of Github issues #646 and #825 and #1191 - if (index >= getQuestData(quest).hasReached.size()) { + if (getQuestData(quest).hasReached.size() <= index) { getQuestData(quest).hasReached.add(true); finishObjective(quest, "reachLocation", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, 1), null, null, null, null, location, null, @@ -2193,7 +2196,6 @@ public class Quester { } } index++; - } catch (IndexOutOfBoundsException e) { plugin.getLogger().severe("An error has occurred with Quests. Please report on Github with info below"); plugin.getLogger().warning("index = " + index);