From 3e5115d64d25345fe03204c7e61f68d813a5f2db Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 12 Dec 2018 02:08:13 -0500 Subject: [PATCH] Ensure reach-location is in the same world, fixes #385 --- src/main/java/me/blackvein/quests/Quester.java | 8 +++++--- src/main/java/me/blackvein/quests/Quests.java | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/blackvein/quests/Quester.java b/src/main/java/me/blackvein/quests/Quester.java index 43dde67c9..703c2817a 100644 --- a/src/main/java/me/blackvein/quests/Quester.java +++ b/src/main/java/me/blackvein/quests/Quester.java @@ -1155,9 +1155,11 @@ public class Quester { if (l.getX() < (locationToReach.getX() + radius) && l.getX() > (locationToReach.getX() - radius)) { if (l.getZ() < (locationToReach.getZ() + radius) && l.getZ() > (locationToReach.getZ() - radius)) { if (l.getY() < (locationToReach.getY() + radius) && l.getY() > (locationToReach.getY() - radius)) { - if (getQuestData(quest).hasReached.get(index) == false) { - getQuestData(quest).hasReached.set(index, true); - finishObjective(quest, "reachLocation", null, null, null, null, null, null, location, null, null, null); + if (l.getWorld().getName().equals(locationToReach.getWorld().getName())) { + if (getQuestData(quest).hasReached.get(index) == false) { + getQuestData(quest).hasReached.set(index, true); + finishObjective(quest, "reachLocation", null, null, null, null, null, null, location, null, null, null); + } } } } diff --git a/src/main/java/me/blackvein/quests/Quests.java b/src/main/java/me/blackvein/quests/Quests.java index 9eae6d6fb..b0eb6e5e1 100644 --- a/src/main/java/me/blackvein/quests/Quests.java +++ b/src/main/java/me/blackvein/quests/Quests.java @@ -3581,11 +3581,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener y = Double.parseDouble(info[yIndex]); z = Double.parseDouble(info[zIndex]); } catch (Exception e) { - Bukkit.getLogger().severe("Please inform developer location was wrong for " + Bukkit.getLogger().severe("Please inform Quests developer location was wrong for " + world + " " + info[xIndex] + " " + info[yIndex] + " " + info[zIndex] + " "); return null; } if (Bukkit.getServer().getWorld(world) == null) { + Bukkit.getLogger().severe("Quests could not locate world " + world + ", is it loaded?"); return null; } Location finalLocation = new Location(Bukkit.getServer().getWorld(world), x, y, z);