From 1b2eb65a105a34ec18db75b964f8b0fcd4258d7e Mon Sep 17 00:00:00 2001 From: HappyPikachu Date: Mon, 4 Dec 2017 22:38:33 -0500 Subject: [PATCH] Permit numbers in world names with spaces, untested, fixes #124 --- pom.xml | 2 +- src/main/java/me/blackvein/quests/Quests.java | 28 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 6b28980cc..2663b97bc 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ me.blackvein.quests quests - 3.0.8 + 3.0.9 quests https://github.com/FlyingPikachu/Quests/ jar diff --git a/src/main/java/me/blackvein/quests/Quests.java b/src/main/java/me/blackvein/quests/Quests.java index c9c98da7a..b56c2cc1d 100644 --- a/src/main/java/me/blackvein/quests/Quests.java +++ b/src/main/java/me/blackvein/quests/Quests.java @@ -3401,18 +3401,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener StringBuilder sb = new StringBuilder(); int index = 0; + int xIndex = info.length -3; + int yIndex = info.length -2; + int zIndex = info.length -1; - for (String s : info) { - try { - Double.parseDouble(s); - break; - } catch (Exception e) { - if (index == 0) { - sb.append(s); - } else { - sb.append(" " + s); - } - index++; + while (index < xIndex) { + String s = info[index]; + if (index == 0) { + sb.append(s); + } else { + sb.append(" " + s); } } @@ -3422,10 +3420,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener double y; double z; try { - x = Double.parseDouble(info[index]); - y = Double.parseDouble(info[index + 1]); - z = Double.parseDouble(info[index + 2]); + x = Double.parseDouble(info[xIndex]); + y = Double.parseDouble(info[yIndex]); + z = Double.parseDouble(info[zIndex]); } catch (Exception e) { + Bukkit.getLogger().severe("Please inform developer location was wrong for " + + world + " " + info[xIndex] + " " + info[yIndex] + " " + info[zIndex] + " "); return null; } if (Bukkit.getServer().getWorld(world) == null) {