Ensure reach-location is in the same world, fixes #385

This commit is contained in:
BuildTools 2018-12-12 02:08:13 -05:00
parent c5dabefc32
commit 3e5115d64d
2 changed files with 7 additions and 4 deletions

View File

@ -1155,6 +1155,7 @@ 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 (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);
@ -1162,6 +1163,7 @@ public class Quester {
}
}
}
}
} catch (IndexOutOfBoundsException e) {
plugin.getLogger().severe("An error has occurred with Quests. Please report on Github. Include the info below");
plugin.getLogger().severe("index = " + getQuestData(quest).locationsReached.indexOf(location));

View File

@ -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);