From ee986cbf77477d8cc54e9cf450e88106091fd7c6 Mon Sep 17 00:00:00 2001 From: HappyPikachu Date: Mon, 12 Feb 2018 00:40:26 -0500 Subject: [PATCH] Better loading for world names with spaces, fixes #285 --- src/main/java/me/blackvein/quests/Quester.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/java/me/blackvein/quests/Quester.java b/src/main/java/me/blackvein/quests/Quester.java index 6f011e6f7..0ec1885f7 100644 --- a/src/main/java/me/blackvein/quests/Quester.java +++ b/src/main/java/me/blackvein/quests/Quester.java @@ -2064,12 +2064,9 @@ public class Quester { LinkedList locations = new LinkedList(); List radii = questSec.getIntegerList("mob-kill-location-radii"); for (String loc : questSec.getStringList("mob-kill-locations")) { - String[] info = loc.split(" "); - double x = Double.parseDouble(info[1]); - double y = Double.parseDouble(info[2]); - double z = Double.parseDouble(info[3]); - Location finalLocation = new Location(plugin.getServer().getWorld(info[0]), x, y, z); - locations.add(finalLocation); + if (Quests.getLocation(loc) != null) { + locations.add(Quests.getLocation(loc)); + } } getQuestData(quest).locationsToKillWithin = locations; getQuestData(quest).radiiToKillWithin.clear(); @@ -2109,12 +2106,9 @@ public class Quester { List has = questSec.getBooleanList("has-reached-location"); List radii = questSec.getIntegerList("radii-to-reach-within"); for (String loc : questSec.getStringList("locations-to-reach")) { - String[] info = loc.split(" "); - double x = Double.parseDouble(info[1]); - double y = Double.parseDouble(info[2]); - double z = Double.parseDouble(info[3]); - Location finalLocation = new Location(plugin.getServer().getWorld(info[0]), x, y, z); - locations.add(finalLocation); + if (Quests.getLocation(loc) != null) { + locations.add(Quests.getLocation(loc)); + } } getQuestData(quest).locationsReached = locations; getQuestData(quest).hasReached.clear();