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,9 +1155,11 @@ public class Quester {
if (l.getX() < (locationToReach.getX() + radius) && l.getX() > (locationToReach.getX() - radius)) { if (l.getX() < (locationToReach.getX() + radius) && l.getX() > (locationToReach.getX() - radius)) {
if (l.getZ() < (locationToReach.getZ() + radius) && l.getZ() > (locationToReach.getZ() - 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.getY() < (locationToReach.getY() + radius) && l.getY() > (locationToReach.getY() - radius)) {
if (getQuestData(quest).hasReached.get(index) == false) { if (l.getWorld().getName().equals(locationToReach.getWorld().getName())) {
getQuestData(quest).hasReached.set(index, true); if (getQuestData(quest).hasReached.get(index) == false) {
finishObjective(quest, "reachLocation", null, null, null, null, null, null, location, null, null, null); getQuestData(quest).hasReached.set(index, true);
finishObjective(quest, "reachLocation", null, null, null, null, null, null, location, null, null, null);
}
} }
} }
} }

View File

@ -3581,11 +3581,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
y = Double.parseDouble(info[yIndex]); y = Double.parseDouble(info[yIndex]);
z = Double.parseDouble(info[zIndex]); z = Double.parseDouble(info[zIndex]);
} catch (Exception e) { } 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] + " "); + world + " " + info[xIndex] + " " + info[yIndex] + " " + info[zIndex] + " ");
return null; return null;
} }
if (Bukkit.getServer().getWorld(world) == null) { if (Bukkit.getServer().getWorld(world) == null) {
Bukkit.getLogger().severe("Quests could not locate world " + world + ", is it loaded?");
return null; return null;
} }
Location finalLocation = new Location(Bukkit.getServer().getWorld(world), x, y, z); Location finalLocation = new Location(Bukkit.getServer().getWorld(world), x, y, z);