multi-string errors when skipping

This commit is contained in:
G Krupa 2014-07-12 01:36:24 -07:00
parent f4c4f3895b
commit 0e1100f812

View File

@ -2312,8 +2312,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (location != null) {
quest.blockStart = location;
} else {
printSevere("[Quests] block-start: for Quest " + quest.name + " is not in proper location format!");
skipQuestProcess("[Quests] Proper location format is: \"WorldName x y z\"");
skipQuestProcess(new String[]{
"[Quests] block-start: for Quest " + quest.name + " is not in proper location format!",
"[Quests] Proper location format is: \"WorldName x y z\""});
}
}
@ -2468,8 +2469,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
if (failed) {
printSevere("[Quests] " + PINK + failedQuest + " inside quests: Requirement for Quest " + quest.name + " is not a valid Quest name!");
skipQuestProcess("Make sure you are using the Quest name: value, and not the block name.");
skipQuestProcess(new String[]{
"[Quests] " + PINK + failedQuest + " inside quests: Requirement for Quest " + quest.name + " is not a valid Quest name!",
"Make sure you are using the Quest name: value, and not the block name."});
}
} else {
@ -2509,8 +2511,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
if (failed) {
printSevere("[Quests] " + failedQuest + " inside quests: Requirement for Quest " + quest.name + " is not a valid Quest name!");
skipQuestProcess("Make sure you are using the Quest name: value, and not the block name.");
skipQuestProcess(new String[]{
"[Quests] " + failedQuest + " inside quests: Requirement for Quest " + quest.name + " is not a valid Quest name!",
"Make sure you are using the Quest name: value, and not the block name."});
}
} else {
@ -2607,7 +2610,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (!found) {
printWarning("[Quests] Custom requirement \"" + name + "\" for Quest \"" + quest.name + "\" could not be found!");
skipQuestProcess(null);
skipQuestProcess((String)null); // null bc we warn, not severe for this one
}
Map<String, Object> data = new HashMap<String, Object>();
@ -2833,11 +2836,19 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} // for()
}
private void skipQuestProcess(String msg) throws SkipQuest {
private void skipQuestProcess(String[] msgs) throws SkipQuest {
for (String msg : msgs) {
if (msg != null) {
printSevere(msg);
}
}
throw new SkipQuest();
}
private void skipQuestProcess(String msg) throws SkipQuest {
skipQuestProcess(new String[]{msg});
}
private void populateCustomRewards(FileConfiguration config) {
ConfigurationSection sec = config.getConfigurationSection("quests." + questName + ".rewards.custom-rewards");
for (String path : sec.getKeys(false)) {
@ -3367,8 +3378,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
y = Double.parseDouble(info[2]);
z = Double.parseDouble(info[3]);
} catch (NumberFormatException e) {
printSevere("[Quests] " + loc + " inside mobs-to-kill: inside Stage " + s2 + " of Quest " + quest.name + " is not in proper location format!");
stageFailed("[Quests] Proper location format is: \"WorldName x y z\"");
stageFailed(new String[]{
"[Quests] " + loc + " inside mobs-to-kill: inside Stage " + s2 + " of Quest " + quest.name + " is not in proper location format!",
"[Quests] Proper location format is: \"WorldName x y z\""});
}
if (getServer().getWorld(info[0]) != null) {
@ -3379,8 +3391,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
} else {
printSevere("[Quests] " + loc + " inside mobs-to-kill: inside Stage " + s2 + " of Quest " + quest.name + " is not in proper location format!");
stageFailed("[Quests] Proper location format is: \"WorldName x y z\"");
stageFailed(new String[]{
"[Quests] " + loc + " inside mobs-to-kill: inside Stage " + s2 + " of Quest " + quest.name + " is not in proper location format!",
"[Quests] Proper location format is: \"WorldName x y z\""});
}
}
@ -3479,8 +3492,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
y = Double.parseDouble(info[2]);
z = Double.parseDouble(info[3]);
} catch (NumberFormatException e) {
printSevere("[Quests] " + loc + " inside locations-to-reach: inside Stage " + s2 + " of Quest " + quest.name + " is not in proper location format!");
stageFailed("[Quests] Proper location format is: \"WorldName x y z\"");
stageFailed(new String[]{
"[Quests] " + loc + " inside locations-to-reach: inside Stage " + s2 + " of Quest " + quest.name + " is not in proper location format!",
"[Quests] Proper location format is: \"WorldName x y z\""});
}
if (getServer().getWorld(info[0]) != null) {
@ -3491,8 +3505,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
} else {
printSevere("[Quests] " + loc + " inside mobs-to-kill: inside Stage " + s2 + " of Quest " + quest.name + " is not in proper location format!");
stageFailed("[Quests] Proper location format is: \"WorldName x y z\"");
stageFailed(new String[]{
"[Quests] " + loc + " inside mobs-to-kill: inside Stage " + s2 + " of Quest " + quest.name + " is not in proper location format!",
"[Quests] Proper location format is: \"WorldName x y z\""});
}
}
@ -3912,13 +3927,17 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
}
private void throwStageFailed() throws StageFailedException {
throw new StageFailedException();
private void stageFailed(String msg) throws StageFailedException {
stageFailed(new String[]{msg});
}
private void stageFailed(String msg) throws StageFailedException {
private void stageFailed(String[] msgs) throws StageFailedException {
for (String msg : msgs) {
if (msg != null) {
printSevere(msg);
throwStageFailed();
}
}
throw new StageFailedException();
}
public void loadEvents() {