diff --git a/pom.xml b/pom.xml
index 6e824eac2..8d5eefb5b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -120,6 +120,8 @@
2.3.2
true
+
+ 1.6
diff --git a/src/main/java/me/blackvein/quests/EventFactory.java b/src/main/java/me/blackvein/quests/EventFactory.java
index 424b6ae29..c9f3abb6a 100644
--- a/src/main/java/me/blackvein/quests/EventFactory.java
+++ b/src/main/java/me/blackvein/quests/EventFactory.java
@@ -1,5 +1,6 @@
package me.blackvein.quests;
+import me.blackvein.quests.util.ColorUtil;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
diff --git a/src/main/java/me/blackvein/quests/NEW b/src/main/java/me/blackvein/quests/NEW
new file mode 100644
index 000000000..570633ad8
--- /dev/null
+++ b/src/main/java/me/blackvein/quests/NEW
@@ -0,0 +1,7 @@
+Heroes support
+ Requirements
+ heroes-primary-class:
+ heroes-secondary-class:
+ Rewards
+ heroes-exp-classes:
+ heroes-exp-amounts:
\ No newline at end of file
diff --git a/src/main/java/me/blackvein/quests/Quest.java b/src/main/java/me/blackvein/quests/Quest.java
index c7b50604b..68c4366c7 100644
--- a/src/main/java/me/blackvein/quests/Quest.java
+++ b/src/main/java/me/blackvein/quests/Quest.java
@@ -2,6 +2,7 @@ package me.blackvein.quests;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.player.UserManager;
+import com.herocraftonline.heroes.characters.Hero;
import java.util.LinkedList;
import java.util.List;
import me.blackvein.quests.util.ItemUtil;
@@ -50,10 +51,10 @@ public class Quest {
LinkedList itemRewards = new LinkedList();
LinkedList rpgItemRewardIDs = new LinkedList();
LinkedList rpgItemRewardAmounts = new LinkedList();
- //mcMMO
List mcmmoSkills = new LinkedList();
List mcmmoAmounts = new LinkedList();
- //
+ List heroesClasses = new LinkedList();
+ List heroesAmounts = new LinkedList();
//
public void nextStage(Quester q) {
@@ -179,26 +180,29 @@ public class Quest {
}
- for(String s : mcMMOSkillReqs) {
+ for (String s : mcMMOSkillReqs) {
final SkillType st = Quests.getMcMMOSkill(s);
final int lvl = mcMMOAmountReqs.get(mcMMOSkillReqs.indexOf(s));
- if(UserManager.getPlayer(player).getProfile().getSkillLevel(st) < lvl)
+ if (UserManager.getPlayer(player).getProfile().getSkillLevel(st) < lvl) {
return false;
+ }
}
- if(heroesPrimaryClassReq != null){
+ if (heroesPrimaryClassReq != null) {
- if(plugin.testPrimaryHeroesClass(heroesPrimaryClassReq, player.getName()) == false)
+ if (plugin.testPrimaryHeroesClass(heroesPrimaryClassReq, player.getName()) == false) {
return false;
+ }
}
- if(heroesSecondaryClassReq != null){
+ if (heroesSecondaryClassReq != null) {
- if(plugin.testSecondaryHeroesClass(heroesSecondaryClassReq, player.getName()) == false)
+ if (plugin.testSecondaryHeroesClass(heroesSecondaryClassReq, player.getName()) == false) {
return false;
+ }
}
@@ -276,6 +280,14 @@ public class Quest {
}
+ for (String s : heroesClasses) {
+
+ Hero hero = plugin.getHero(player.getName());
+ hero.addExp(heroesAmounts.get(heroesClasses.indexOf(s)), Quests.heroes.getClassManager().getClass(s), player.getLocation());
+ none = null;
+
+ }
+
if (exp > 0) {
player.giveExp(exp);
none = null;
@@ -328,6 +340,12 @@ public class Quest {
}
}
+ if (heroesClasses.isEmpty() == false) {
+ for (String s : heroesClasses) {
+ player.sendMessage("- " + ChatColor.AQUA + heroesAmounts.get(heroesClasses.indexOf(s)) + " " + ChatColor.BLUE + s + " Experience");
+ }
+ }
+
if (none != null) {
player.sendMessage(none);
}
@@ -444,6 +462,14 @@ public class Quest {
return false;
}
+ if (other.heroesClasses.equals(heroesClasses) == false) {
+ return false;
+ }
+
+ if (other.heroesAmounts.equals(heroesAmounts) == false) {
+ return false;
+ }
+
if (other.moneyReq != moneyReq) {
return false;
}
@@ -522,7 +548,6 @@ public class Quest {
return false;
}
-
if (other.stages.equals(stages) == false) {
return false;
}
diff --git a/src/main/java/me/blackvein/quests/QuestFactory.java b/src/main/java/me/blackvein/quests/QuestFactory.java
index 10fa4e8f3..628e5698b 100644
--- a/src/main/java/me/blackvein/quests/QuestFactory.java
+++ b/src/main/java/me/blackvein/quests/QuestFactory.java
@@ -1,5 +1,6 @@
package me.blackvein.quests;
+import me.blackvein.quests.util.ColorUtil;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
@@ -828,7 +829,6 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
}
- @SuppressWarnings("unchecked")
public static void saveQuest(ConversationContext cc, ConfigurationSection cs) {
String edit = null;
@@ -871,6 +871,8 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
LinkedList questBlocks = null;
LinkedList mcMMOSkillReqs = null;
LinkedList mcMMOAmountReqs = null;
+ String heroesPrimaryReq = null;
+ String heroesSecondaryReq = null;
String failMessage = null;
Integer moneyRew = null;
@@ -883,7 +885,10 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
LinkedList permRews = null;
LinkedList mcMMOSkillRews = null;
LinkedList mcMMOSkillAmounts = null;
+ LinkedList heroesClassRews = null;
+ LinkedList heroesExpRews = null;
+
if (cc.getSessionData(CK.Q_REDO_DELAY) != null) {
redo = (Long) cc.getSessionData(CK.Q_REDO_DELAY);
}
@@ -925,6 +930,14 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
mcMMOSkillReqs = (LinkedList) cc.getSessionData(CK.REQ_MCMMO_SKILLS);
mcMMOAmountReqs = (LinkedList) cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS);
}
+
+ if (cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null) {
+ heroesPrimaryReq = (String) cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS);
+ }
+
+ if (cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null) {
+ heroesSecondaryReq = (String) cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS);
+ }
if (cc.getSessionData(CK.Q_FAIL_MESSAGE) != null) {
failMessage = (String) cc.getSessionData(CK.Q_FAIL_MESSAGE);
@@ -976,6 +989,11 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
mcMMOSkillRews = (LinkedList) cc.getSessionData(CK.REW_MCMMO_SKILLS);
mcMMOSkillAmounts = (LinkedList) cc.getSessionData(CK.REW_MCMMO_AMOUNTS);
}
+
+ if (cc.getSessionData(CK.REW_HEROES_CLASSES) != null) {
+ heroesClassRews = (LinkedList) cc.getSessionData(CK.REW_HEROES_CLASSES);
+ heroesExpRews = (LinkedList) cc.getSessionData(CK.REW_HEROES_AMOUNTS);
+ }
cs.set("name", name);
cs.set("npc-giver-id", npcStart);
@@ -985,7 +1003,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
cs.set("finish-message", finish);
cs.set(CK.S_FINISH_EVENT, initialEvent);
- if (moneyReq != null || questPointsReq != null || itemReqs != null && itemReqs.isEmpty() == false || permReqs != null && permReqs.isEmpty() == false || (questReqs != null && questReqs.isEmpty() == false) || (questBlocks != null && questBlocks.isEmpty() == false) || (mcMMOSkillReqs != null && mcMMOSkillReqs.isEmpty() == false)) {
+ if (moneyReq != null || questPointsReq != null || itemReqs != null && itemReqs.isEmpty() == false || permReqs != null && permReqs.isEmpty() == false || (questReqs != null && questReqs.isEmpty() == false) || (questBlocks != null && questBlocks.isEmpty() == false) || (mcMMOSkillReqs != null && mcMMOSkillReqs.isEmpty() == false) || heroesPrimaryReq != null || heroesSecondaryReq != null) {
ConfigurationSection reqs = cs.createSection("requirements");
List items = new LinkedList();
@@ -1006,6 +1024,8 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
reqs.set("quest-blocks", questBlocks);
reqs.set("mcmmo-skills", mcMMOSkillReqs);
reqs.set("mcmmo-amounts", mcMMOAmountReqs);
+ reqs.set("heroes-primary-class", heroesPrimaryReq);
+ reqs.set("heroes-secondary-class", heroesSecondaryReq);
reqs.set("fail-requirement-message", failMessage);
} else {
@@ -1341,11 +1361,15 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
- if (moneyRew != null || questPointsRew != null || itemRews != null && itemRews.isEmpty() == false || permRews != null && permRews.isEmpty() == false || expRew != null || commandRews != null && commandRews.isEmpty() == false || mcMMOSkillRews != null || RPGItemRews != null) {
+ System.out.println("HERE 1");
+
+ if (moneyRew != null || questPointsRew != null || itemRews != null && itemRews.isEmpty() == false || permRews != null && permRews.isEmpty() == false || expRew != null || commandRews != null && commandRews.isEmpty() == false || mcMMOSkillRews != null || RPGItemRews != null || heroesClassRews != null && heroesClassRews.isEmpty() == false) {
+ System.out.println("HERE 2");
+
ConfigurationSection rews = cs.createSection("rewards");
- rews.set("items", (itemRews.isEmpty() == false) ? itemRews : null);
+ rews.set("items", (itemRews != null && itemRews.isEmpty() == false) ? itemRews : null);
rews.set("money", moneyRew);
rews.set("quest-points", questPointsRew);
rews.set("exp", expRew);
@@ -1355,10 +1379,14 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
rews.set("mcmmo-levels", mcMMOSkillAmounts);
rews.set("rpgitem-ids", RPGItemRews);
rews.set("rpgitem-amounts", RPGItemAmounts);
+ rews.set("heroes-exp-classes", heroesClassRews);
+ rews.set("heroes-exp-amounts", heroesExpRews);
} else {
cs.set("rewards", null);
}
+
+ System.out.println("HERE 3");
}
@@ -1454,11 +1482,21 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
cc.setSessionData(CK.REW_MCMMO_SKILLS, q.mcmmoSkills);
cc.setSessionData(CK.REW_MCMMO_AMOUNTS, q.mcmmoAmounts);
}
+
+ if (q.heroesClasses.isEmpty() == false) {
+ cc.setSessionData(CK.REW_HEROES_CLASSES, q.heroesClasses);
+ cc.setSessionData(CK.REW_HEROES_AMOUNTS, q.heroesAmounts);
+ }
if (q.rpgItemRewardIDs.isEmpty() == false) {
cc.setSessionData(CK.REW_RPG_ITEM_IDS, q.rpgItemRewardIDs);
cc.setSessionData(CK.REW_RPG_ITEM_AMOUNTS, q.rpgItemRewardAmounts);
}
+
+ if(q.heroesClasses.isEmpty() == false) {
+ cc.setSessionData(CK.REW_HEROES_CLASSES, q.heroesClasses);
+ cc.setSessionData(CK.REW_HEROES_AMOUNTS, q.heroesAmounts);
+ }
//
//Stages
diff --git a/src/main/java/me/blackvein/quests/Quests.java b/src/main/java/me/blackvein/quests/Quests.java
index 376eec448..b0cb4eb35 100644
--- a/src/main/java/me/blackvein/quests/Quests.java
+++ b/src/main/java/me/blackvein/quests/Quests.java
@@ -1,5 +1,6 @@
package me.blackvein.quests;
+import me.blackvein.quests.util.ColorUtil;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.mcMMO;
@@ -566,9 +567,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if(quest.heroesPrimaryClassReq != null){
if(this.testPrimaryHeroesClass(quest.heroesPrimaryClassReq, player.getName())){
- cs.sendMessage(BOLD + "" + DARKRED + quest.heroesPrimaryClassReq + RESET + "" + RED + " class");
- }else{
cs.sendMessage(BOLD + "" + GREEN + quest.heroesPrimaryClassReq + RESET + "" + DARKGREEN + " class");
+ }else{
+ cs.sendMessage(BOLD + "" + DARKRED + quest.heroesPrimaryClassReq + RESET + "" + RED + " class");
}
}
@@ -3408,27 +3409,34 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (Quests.checkList(config.getList("quests." + s + ".rewards.mcmmo-skills"), String.class)) {
if (config.contains("quests." + s + ".rewards.mcmmo-levels")) {
+
+ if(Quests.checkList(config.getList("quests." + s + ".rewards.mcmmo-levels"), Integer.class)){
- boolean failed = false;
- for (String skill : config.getStringList("quests." + s + ".rewards.mcmmo-skills")) {
+ boolean failed = false;
+ for (String skill : config.getStringList("quests." + s + ".rewards.mcmmo-skills")) {
- if (Quests.getMcMMOSkill(skill) == null) {
- printSevere("[Quests] " + skill + " in mcmmo-skills: Reward in Quest " + quest.name + " is not a valid mcMMO skill name!");
- failed = true;
- break;
+ if (Quests.getMcMMOSkill(skill) == null) {
+ printSevere("[Quests] " + skill + " in mcmmo-skills: Reward in Quest " + quest.name + " is not a valid mcMMO skill name!");
+ failed = true;
+ break;
+ }
+
+ }
+ if (failed) {
+ continue;
}
- }
- if (failed) {
+ quest.mcmmoSkills.clear();
+ quest.mcmmoAmounts.clear();
+
+ quest.mcmmoSkills.addAll(config.getStringList("quests." + s + ".rewards.mcmmo-skills"));
+ quest.mcmmoAmounts.addAll(config.getIntegerList("quests." + s + ".rewards.mcmmo-levels"));
+
+ } else {
+ printSevere("[Quests] mcmmo-levels: Reward in Quest " + quest.name + " is not a list of numbers!");
continue;
}
- quest.mcmmoSkills.clear();
- quest.mcmmoAmounts.clear();
-
- quest.mcmmoSkills.addAll(config.getStringList("quests." + s + ".rewards.mcmmo-skills"));
- quest.mcmmoAmounts.addAll(config.getIntegerList("quests." + s + ".rewards.mcmmo-levels"));
-
} else {
printSevere("[Quests] Rewards for Quest " + quest.name + " is missing mcmmo-levels:");
continue;
@@ -3439,6 +3447,50 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
continue;
}
}
+
+ if (config.contains("quests." + s + ".rewards.heroes-exp-classes")) {
+
+ if (Quests.checkList(config.getList("quests." + s + ".rewards.heroes-exp-classes"), String.class)) {
+
+ if (config.contains("quests." + s + ".rewards.heroes-exp-amounts")) {
+
+ if (Quests.checkList(config.getList("quests." + s + ".rewards.heroes-exp-amounts"), Double.class)) {
+
+ boolean failed = false;
+ for (String heroClass : config.getStringList("quests." + s + ".rewards.heroes-exp-classes")) {
+
+ if (Quests.heroes.getClassManager().getClass(heroClass) == null) {
+ printSevere("[Quests] " + heroClass + " in heroes-exp-classes: Reward in Quest " + quest.name + " is not a valid Heroes class name!");
+ failed = true;
+ break;
+ }
+
+ }
+ if (failed) {
+ continue;
+ }
+
+ quest.heroesClasses.clear();
+ quest.heroesAmounts.clear();
+
+ quest.heroesClasses.addAll(config.getStringList("quests." + s + ".rewards.heroes-exp-classes"));
+ quest.heroesAmounts.addAll(config.getDoubleList("quests." + s + ".rewards.heroes-exp-amounts"));
+
+ } else {
+ printSevere("[Quests] heroes-exp-amounts: Reward in Quest " + quest.name + " is not a list of experience amounts (decimal numbers)!");
+ continue;
+ }
+
+ } else {
+ printSevere("[Quests] Rewards for Quest " + quest.name + " is missing heroes-exp-amounts:");
+ continue;
+ }
+
+ } else {
+ printSevere("[Quests] heroes-exp-classes: Reward in Quest " + quest.name + " is not a list of Heroes classes!");
+ continue;
+ }
+ }
//
quests.add(quest);
diff --git a/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java b/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java
index d6adbf629..00dbd5f1f 100644
--- a/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java
+++ b/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java
@@ -4,7 +4,7 @@ import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import me.ThaH3lper.com.Mobs.EpicMobs;
-import me.blackvein.quests.ColorUtil;
+import me.blackvein.quests.util.ColorUtil;
import me.blackvein.quests.Event;
import me.blackvein.quests.QuestFactory;
import me.blackvein.quests.Quester;
@@ -2254,7 +2254,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
}
- text += DARKGRAY + "|---------" + Lang.get("stageEditorOptional") + "---------|";
+ text += DARKGRAY + "|---------" + Lang.get("stageEditorOptional") + "---------|\n";
if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS) == null) {
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetKillLocations") + " (" + Lang.get("noneSet") + ")\n";
diff --git a/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java b/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java
index 43e83cbd9..f54ca8f09 100644
--- a/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java
+++ b/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java
@@ -6,7 +6,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import me.blackvein.quests.ColorUtil;
+import me.blackvein.quests.util.ColorUtil;
import me.blackvein.quests.ItemData;
import me.blackvein.quests.ItemData.Data;
import me.blackvein.quests.Quester;
diff --git a/src/main/java/me/blackvein/quests/prompts/QuestAcceptPrompt.java b/src/main/java/me/blackvein/quests/prompts/QuestAcceptPrompt.java
index 8f4e4d190..2e96a5edd 100644
--- a/src/main/java/me/blackvein/quests/prompts/QuestAcceptPrompt.java
+++ b/src/main/java/me/blackvein/quests/prompts/QuestAcceptPrompt.java
@@ -2,7 +2,7 @@ package me.blackvein.quests.prompts;
import java.text.MessageFormat;
import java.util.LinkedList;
-import me.blackvein.quests.ColorUtil;
+import me.blackvein.quests.util.ColorUtil;
import me.blackvein.quests.Quest;
import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests;
diff --git a/src/main/java/me/blackvein/quests/prompts/RequirementsPrompt.java b/src/main/java/me/blackvein/quests/prompts/RequirementsPrompt.java
index b95c2f845..72a6f5466 100644
--- a/src/main/java/me/blackvein/quests/prompts/RequirementsPrompt.java
+++ b/src/main/java/me/blackvein/quests/prompts/RequirementsPrompt.java
@@ -1,12 +1,13 @@
package me.blackvein.quests.prompts;
+import com.herocraftonline.heroes.characters.classes.HeroClass;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
-import me.blackvein.quests.ColorUtil;
+import me.blackvein.quests.util.ColorUtil;
import me.blackvein.quests.Quest;
import me.blackvein.quests.QuestFactory;
import me.blackvein.quests.Quests;
@@ -29,7 +30,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
public RequirementsPrompt(Quests plugin, QuestFactory qf) {
- super("1", "2", "3", "4", "5", "6", "7", "8", "9");
+ super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
quests = plugin;
factory = qf;
@@ -98,7 +99,6 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
if (Quests.mcmmo != null) {
-
if (context.getSessionData(CK.REQ_MCMMO_SKILLS) == null) {
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set mcMMO requirements " + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
@@ -115,18 +115,35 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
text += GRAY + "6 - Set mcMMO requirements (mcMMO not installed)\n";
}
+ if (Quests.heroes != null) {
+ if (context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null && context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null) {
+ text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set Heroes requirements " + GRAY + " (" + Lang.get("noneSet") + ")\n";
+ } else {
+ text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set Heroes requirements\n";
+
+ if (context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null) {
+ text += AQUA + " Primary Class: " + BLUE + (String) context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) + "\n";
+ }
+
+ if (context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null) {
+ text += AQUA + " Secondary Class: " + BLUE + (String) context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) + "\n";
+ }
+ }
- if (context.getSessionData(CK.REQ_MONEY) == null && context.getSessionData(CK.REQ_QUEST_POINTS) == null && context.getSessionData(CK.REQ_QUEST_BLOCK) == null && context.getSessionData(CK.REQ_ITEMS) == null && context.getSessionData(CK.REQ_PERMISSION) == null && context.getSessionData(CK.REQ_QUEST) == null && context.getSessionData(CK.REQ_QUEST_BLOCK) == null && context.getSessionData(CK.REQ_MCMMO_SKILLS) == null) {
- text += GRAY + "" + BOLD + "8 - " + RESET + GRAY + "Set fail requirements message (No requirements set)\n";
- } else if (context.getSessionData(CK.Q_FAIL_MESSAGE) == null) {
- text += RED + "" + BOLD + "8 - " + RESET + RED + "Set fail requirements message (Required)\n";
} else {
- text += BLUE + "" + BOLD + "8 - " + RESET + YELLOW + "Set fail requirements message" + GRAY + "(" + AQUA + "\"" + context.getSessionData(CK.Q_FAIL_MESSAGE) + "\"" + GRAY + ")\n";
+ text += GRAY + "8 - Set Heroes requirements (Heroes not installed)\n";
}
- text += GREEN + "" + BOLD + "9" + RESET + YELLOW + " - Done";
+ if (context.getSessionData(CK.REQ_MONEY) == null && context.getSessionData(CK.REQ_QUEST_POINTS) == null && context.getSessionData(CK.REQ_QUEST_BLOCK) == null && context.getSessionData(CK.REQ_ITEMS) == null && context.getSessionData(CK.REQ_PERMISSION) == null && context.getSessionData(CK.REQ_QUEST) == null && context.getSessionData(CK.REQ_QUEST_BLOCK) == null && context.getSessionData(CK.REQ_MCMMO_SKILLS) == null && context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null && context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null) {
+ text += GRAY + "" + BOLD + "9 - " + RESET + GRAY + "Set fail requirements message (No requirements set)\n";
+ } else if (context.getSessionData(CK.Q_FAIL_MESSAGE) == null) {
+ text += RED + "" + BOLD + "9 - " + RESET + RED + "Set fail requirements message (Required)\n";
+ } else {
+ text += BLUE + "" + BOLD + "9 - " + RESET + YELLOW + "Set fail requirements message" + GRAY + "(" + AQUA + "\"" + context.getSessionData(CK.Q_FAIL_MESSAGE) + "\"" + GRAY + ")\n";
+ }
+ text += GREEN + "" + BOLD + "10" + RESET + YELLOW + " - Done";
return text;
@@ -148,14 +165,21 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
} else if (input.equalsIgnoreCase("6")) {
return new QuestListPrompt(false);
} else if (input.equalsIgnoreCase("7")) {
- if(Quests.mcmmo != null)
+ if (Quests.mcmmo != null) {
return new mcMMOPrompt();
- else
+ } else {
return new RequirementsPrompt(quests, factory);
+ }
} else if (input.equalsIgnoreCase("8")) {
- return new FailMessagePrompt();
+ if (Quests.heroes != null) {
+ return new HeroesPrompt();
+ } else {
+ return new RequirementsPrompt(quests, factory);
+ }
} else if (input.equalsIgnoreCase("9")) {
- if (context.getSessionData(CK.REQ_MONEY) != null || context.getSessionData(CK.REQ_QUEST_POINTS) != null || context.getSessionData(CK.REQ_ITEMS) != null || context.getSessionData(CK.REQ_PERMISSION) != null || context.getSessionData(CK.REQ_QUEST) != null || context.getSessionData(CK.REQ_QUEST_BLOCK) != null || context.getSessionData(CK.REQ_MCMMO_SKILLS) != null) {
+ return new FailMessagePrompt();
+ } else if (input.equalsIgnoreCase("10")) {
+ if (context.getSessionData(CK.REQ_MONEY) != null || context.getSessionData(CK.REQ_QUEST_POINTS) != null || context.getSessionData(CK.REQ_ITEMS) != null || context.getSessionData(CK.REQ_PERMISSION) != null || context.getSessionData(CK.REQ_QUEST) != null || context.getSessionData(CK.REQ_QUEST_BLOCK) != null || context.getSessionData(CK.REQ_MCMMO_SKILLS) != null || context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null || context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null) {
if (context.getSessionData(CK.Q_FAIL_MESSAGE) == null) {
context.getForWhom().sendRawMessage(RED + "You must set a fail requirements message!");
@@ -365,7 +389,6 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add item\n";
-
if (context.getSessionData(CK.REQ_ITEMS_REMOVE) == null) {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set remove items (No values set)\n";
} else {
@@ -505,79 +528,79 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
}
}
-
+
private class mcMMOPrompt extends FixedSetPrompt {
- public mcMMOPrompt(){
+ public mcMMOPrompt() {
super("1", "2", "3");
}
-
+
@Override
public String getPromptText(ConversationContext cc) {
-
+
String text = DARKGREEN + "- mcMMO Requirements -\n";
- if(cc.getSessionData(CK.REQ_MCMMO_SKILLS) == null){
+ if (cc.getSessionData(CK.REQ_MCMMO_SKILLS) == null) {
text += BOLD + "" + GREEN + "1" + RESET + GREEN + " - Set skills (None set)\n";
- }else{
+ } else {
text += BOLD + "" + GREEN + "1" + RESET + GREEN + " - Set skills\n";
LinkedList skills = (LinkedList) cc.getSessionData(CK.REQ_MCMMO_SKILLS);
- for(String skill : skills){
+ for (String skill : skills) {
text += GRAY + " - " + AQUA + skill + "\n";
}
}
-
- if(cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS) == null){
+
+ if (cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS) == null) {
text += BOLD + "" + GREEN + "2" + RESET + GREEN + " - Set skill amounts (None set)\n";
- }else{
+ } else {
text += BOLD + "" + GREEN + "2" + RESET + GREEN + " - Set skill amounts\n";
LinkedList amounts = (LinkedList) cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS);
- for(int i : amounts){
+ for (int i : amounts) {
text += GRAY + " - " + AQUA + i + "\n";
}
}
-
+
text += BOLD + "" + GREEN + "3" + RESET + GREEN + " - Done";
-
+
return text;
}
@Override
protected Prompt acceptValidatedInput(ConversationContext cc, String input) {
-
- if(input.equalsIgnoreCase("1")){
+
+ if (input.equalsIgnoreCase("1")) {
return new mcMMOSkillsPrompt();
- }else if(input.equalsIgnoreCase("2")){
+ } else if (input.equalsIgnoreCase("2")) {
return new mcMMOAmountsPrompt();
- }else if(input.equalsIgnoreCase("3")){
+ } else if (input.equalsIgnoreCase("3")) {
return new RequirementsPrompt(quests, factory);
}
-
+
return null;
-
+
}
}
-
+
private class mcMMOSkillsPrompt extends StringPrompt {
-
+
@Override
public String getPromptText(ConversationContext context) {
-
- String skillList =
- DARKGREEN + "-Skill List-\n" +
- GREEN + "Acrobatics\n" +
- GREEN + "All\n" +
- GREEN + "Archery\n" +
- GREEN + "Axes\n" +
- GREEN + "Excavation\n" +
- GREEN + "Fishing\n" +
- GREEN + "Herbalism\n" +
- GREEN + "Mining\n" +
- GREEN + "Repair\n" +
- GREEN + "Smelting\n" +
- GREEN + "Swords\n" +
- GREEN + "Taming\n" +
- GREEN + "Unarmed\n" +
- GREEN + "Woodcutting\n\n";
+
+ String skillList
+ = DARKGREEN + "-Skill List-\n"
+ + GREEN + "Acrobatics\n"
+ + GREEN + "All\n"
+ + GREEN + "Archery\n"
+ + GREEN + "Axes\n"
+ + GREEN + "Excavation\n"
+ + GREEN + "Fishing\n"
+ + GREEN + "Herbalism\n"
+ + GREEN + "Mining\n"
+ + GREEN + "Repair\n"
+ + GREEN + "Smelting\n"
+ + GREEN + "Swords\n"
+ + GREEN + "Taming\n"
+ + GREEN + "Unarmed\n"
+ + GREEN + "Woodcutting\n\n";
return skillList + YELLOW + "Enter mcMMO skills, separating each one by a space, or enter \'clear\' to clear the list, "
+ "or \'cancel\' to return.\n";
@@ -587,44 +610,44 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
-
+
LinkedList skills = new LinkedList();
-
- for(String s : input.split(" ")){
-
+
+ for (String s : input.split(" ")) {
+
String formatted = MiscUtil.getCapitalized(s);
-
- if(Quests.getMcMMOSkill(formatted) != null){
+
+ if (Quests.getMcMMOSkill(formatted) != null) {
skills.add(formatted);
- }else if(skills.contains(formatted)){
+ } else if (skills.contains(formatted)) {
cc.getForWhom().sendRawMessage(YELLOW + "Error: List contains duplicates!");
return new mcMMOSkillsPrompt();
- }else{
+ } else {
cc.getForWhom().sendRawMessage(YELLOW + "Error: " + RED + s + YELLOW + " is not an mcMMO skill name!");
return new mcMMOSkillsPrompt();
}
-
+
}
-
+
cc.setSessionData(CK.REQ_MCMMO_SKILLS, skills);
return new mcMMOPrompt();
-
- }else if(input.equalsIgnoreCase("clear")){
+
+ } else if (input.equalsIgnoreCase("clear")) {
cc.getForWhom().sendRawMessage(YELLOW + "mcMMO skill requirements cleared.");
cc.setSessionData(CK.REQ_MCMMO_SKILLS, null);
return new mcMMOPrompt();
- }else if(input.equalsIgnoreCase("cancel")){
+ } else if (input.equalsIgnoreCase("cancel")) {
return new mcMMOPrompt();
}
return new mcMMOSkillsPrompt();
}
-
+
}
-
+
private class mcMMOAmountsPrompt extends StringPrompt {
-
+
@Override
public String getPromptText(ConversationContext context) {
@@ -636,38 +659,217 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
-
+
LinkedList amounts = new LinkedList();
-
- for(String s : input.split(" ")){
-
- try{
-
+
+ for (String s : input.split(" ")) {
+
+ try {
+
int i = Integer.parseInt(s);
amounts.add(i);
-
- }catch(NumberFormatException nfe){
+
+ } catch (NumberFormatException nfe) {
cc.getForWhom().sendRawMessage(YELLOW + "Error: " + RED + s + YELLOW + " is not a number!");
return new mcMMOAmountsPrompt();
}
-
+
}
-
+
cc.setSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS, amounts);
return new mcMMOPrompt();
-
- }else if(input.equalsIgnoreCase("clear")){
+
+ } else if (input.equalsIgnoreCase("clear")) {
cc.getForWhom().sendRawMessage(YELLOW + "mcMMO skill amount requirements cleared.");
cc.setSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS, null);
return new mcMMOPrompt();
- }else if(input.equalsIgnoreCase("cancel")){
+ } else if (input.equalsIgnoreCase("cancel")) {
return new mcMMOPrompt();
}
return new mcMMOAmountsPrompt();
}
-
+
+ }
+
+ private class HeroesPrompt extends FixedSetPrompt {
+
+ public HeroesPrompt() {
+ super("1", "2", "3");
+ }
+
+ @Override
+ public String getPromptText(ConversationContext cc) {
+
+ String text = DARKGREEN + "- Heroes Requirements -\n";
+ if (cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null) {
+ text += BOLD + "" + GREEN + "1" + RESET + GREEN + " - Set Primary Class (None set)\n";
+ } else {
+ text += BOLD + "" + GREEN + "1" + RESET + GREEN + " - Set Primary Class (" + AQUA + (String) cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) + GREEN + ")\n";
+ }
+
+ if (cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null) {
+ text += BOLD + "" + GREEN + "2" + RESET + GREEN + " - Set Secondary Class (None set)\n";
+ } else {
+ text += BOLD + "" + GREEN + "2" + RESET + GREEN + " - Set Secondary Class (" + AQUA + (String) cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) + GREEN + ")\n";
+ }
+
+ text += BOLD + "" + GREEN + "3" + RESET + GREEN + " - Done";
+
+ return text;
+ }
+
+ @Override
+ protected Prompt acceptValidatedInput(ConversationContext cc, String input) {
+
+ if (input.equalsIgnoreCase("1")) {
+ return new HeroesPrimaryPrompt();
+ } else if (input.equalsIgnoreCase("2")) {
+ return new HeroesSecondaryPrompt();
+ } else if (input.equalsIgnoreCase("3")) {
+ return new RequirementsPrompt(quests, factory);
+ }
+
+ return null;
+
+ }
+ }
+
+ private class HeroesPrimaryPrompt extends StringPrompt {
+
+ @Override
+ public String getPromptText(ConversationContext cc) {
+
+ String text = PURPLE + "- " + PINK + "Primary Classes" + PURPLE + " -\n";
+ LinkedList list = new LinkedList();
+ for (HeroClass hc : Quests.heroes.getClassManager().getClasses()) {
+ if (hc.isPrimary()) {
+ list.add(hc.getName());
+ }
+ }
+
+ if (list.isEmpty()) {
+ text += GRAY + "(None)";
+ } else {
+
+ Collections.sort(list);
+
+ for (String s : list) {
+ text += PURPLE + "- " + PINK + s + "\n";
+ }
+
+ }
+
+ text += YELLOW + "Enter a Heroes Primary Class name, or enter \"clear\" to clear the requirement, or \"cancel\" to return.";
+
+ return text;
+ }
+
+ @Override
+ public Prompt acceptInput(ConversationContext cc, String input) {
+
+ if (input.equalsIgnoreCase("clear") == false && input.equalsIgnoreCase("cancel") == false) {
+
+ HeroClass hc = Quests.heroes.getClassManager().getClass(input);
+ if (hc != null) {
+
+ if (hc.isPrimary()) {
+
+ cc.setSessionData(CK.REQ_HEROES_PRIMARY_CLASS, hc.getName());
+ return new HeroesPrompt();
+
+ } else {
+ cc.getForWhom().sendRawMessage(RED + "The " + PINK + hc.getName() + RED + " class is not primary!");
+ return new HeroesPrimaryPrompt();
+ }
+
+ } else {
+ cc.getForWhom().sendRawMessage(RED + "Class not found!");
+ return new HeroesPrimaryPrompt();
+ }
+
+ } else if (input.equalsIgnoreCase("clear")) {
+
+ cc.setSessionData(CK.REQ_HEROES_PRIMARY_CLASS, null);
+ cc.getForWhom().sendRawMessage(YELLOW + "Heroes Primary Class requirement cleared.");
+ return new HeroesPrompt();
+
+ } else {
+
+ return new HeroesPrompt();
+
+ }
+
+ }
+ }
+
+ private class HeroesSecondaryPrompt extends StringPrompt {
+
+ @Override
+ public String getPromptText(ConversationContext cc) {
+
+ String text = PURPLE + "- " + PINK + "Secondary Classes" + PURPLE + " -\n";
+ LinkedList list = new LinkedList();
+ for (HeroClass hc : Quests.heroes.getClassManager().getClasses()) {
+ if (hc.isSecondary()) {
+ list.add(hc.getName());
+ }
+ }
+
+ if (list.isEmpty()) {
+ text += GRAY + "(None)";
+ } else {
+
+ Collections.sort(list);
+
+ for (String s : list) {
+ text += PURPLE + "- " + PINK + s + "\n";
+ }
+
+ }
+
+ text += YELLOW + "Enter a Heroes Secondary Class name, or enter \"clear\" to clear the requirement, or \"cancel\" to return.";
+
+ return text;
+ }
+
+ @Override
+ public Prompt acceptInput(ConversationContext cc, String input) {
+
+ if (input.equalsIgnoreCase("clear") == false && input.equalsIgnoreCase("cancel") == false) {
+
+ HeroClass hc = Quests.heroes.getClassManager().getClass(input);
+ if (hc != null) {
+
+ if (hc.isSecondary()) {
+
+ cc.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, hc.getName());
+ return new HeroesPrompt();
+
+ } else {
+ cc.getForWhom().sendRawMessage(RED + "The " + PINK + hc.getName() + RED + " class is not secondary!");
+ return new HeroesSecondaryPrompt();
+ }
+
+ } else {
+ cc.getForWhom().sendRawMessage(RED + "Class not found!");
+ return new HeroesSecondaryPrompt();
+ }
+
+ } else if (input.equalsIgnoreCase("clear")) {
+
+ cc.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, null);
+ cc.getForWhom().sendRawMessage(YELLOW + "Heroes Secondary Class requirement cleared.");
+ return new HeroesPrompt();
+
+ } else {
+
+ return new HeroesPrompt();
+
+ }
+
+ }
}
private class FailMessagePrompt extends StringPrompt {
diff --git a/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java b/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java
index 52a0dc348..300d9b379 100644
--- a/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java
+++ b/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java
@@ -1,9 +1,11 @@
package me.blackvein.quests.prompts;
+import com.herocraftonline.heroes.characters.classes.HeroClass;
import java.util.Arrays;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-import me.blackvein.quests.ColorUtil;
+import me.blackvein.quests.util.ColorUtil;
import me.blackvein.quests.QuestFactory;
import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests;
@@ -19,55 +21,53 @@ import org.bukkit.inventory.ItemStack;
import think.rpgitems.item.ItemManager;
import think.rpgitems.item.RPGItem;
-
-public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
+public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
final Quests quests;
final QuestFactory factory;
- public RewardsPrompt(Quests plugin, QuestFactory qf){
+ public RewardsPrompt(Quests plugin, QuestFactory qf) {
- super("1", "2", "3", "4", "5", "6", "7", "8", "9");
+ super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
quests = plugin;
factory = qf;
}
@Override
- public String getPromptText(ConversationContext context){
+ public String getPromptText(ConversationContext context) {
String text;
text = DARKAQUA + "- " + AQUA + context.getSessionData(CK.Q_NAME) + AQUA + " | Rewards -\n";
- if(context.getSessionData(CK.REW_MONEY) == null)
+ if (context.getSessionData(CK.REW_MONEY) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money reward (None set)\n";
- else{
+ } else {
int moneyRew = (Integer) context.getSessionData(CK.REW_MONEY);
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money reward (" + moneyRew + " " + (moneyRew > 1 ? Quests.getCurrency(true) : Quests.getCurrency(false)) + ")\n";
}
- if(context.getSessionData(CK.REW_QUEST_POINTS) == null)
+ if (context.getSessionData(CK.REW_QUEST_POINTS) == null) {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set Quest Points reward (None set)\n";
- else{
+ } else {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set Quest Points reward (" + context.getSessionData(CK.REW_QUEST_POINTS) + " Quest Points)\n";
}
- text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set item rewards\n";
+ text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set item rewards\n";
//RPGItems
+ if (Quests.rpgItems != null) {
- if(Quests.rpgItems != null){
-
- if(context.getSessionData(CK.REW_RPG_ITEM_IDS) == null)
+ if (context.getSessionData(CK.REW_RPG_ITEM_IDS) == null) {
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set RPGItem rewards (None set)\n";
- else{
+ } else {
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set RPGItem rewards\n";
List rpgItems = (List) context.getSessionData(CK.REW_RPG_ITEM_IDS);
List rpgItemAmounts = (List) context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS);
- for(Integer i : rpgItems){
+ for (Integer i : rpgItems) {
RPGItem item = ItemManager.getItemById(i);
text += GRAY + " - " + PINK + ITALIC + item.getName() + RESET + GRAY + " x " + PURPLE + rpgItemAmounts.get(rpgItems.indexOf(i)) + "\n";
@@ -75,103 +75,129 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}
}
- }else{
+ } else {
text += GRAY + "4 - Set RPGItem rewards (RPGItems not installed)\n";
}
//
-
- if(context.getSessionData(CK.REW_EXP) == null)
+ if (context.getSessionData(CK.REW_EXP) == null) {
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set experience reward (None set)\n";
- else{
+ } else {
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set experience reward (" + context.getSessionData(CK.REW_EXP) + " points)\n";
}
- if(context.getSessionData(CK.REW_COMMAND) == null)
+ if (context.getSessionData(CK.REW_COMMAND) == null) {
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set command rewards (None set)\n";
- else{
+ } else {
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set command rewards\n";
List commands = (List) context.getSessionData(CK.REW_COMMAND);
- for(String cmd : commands){
+ for (String cmd : commands) {
text += GRAY + " - " + AQUA + cmd + "\n";
}
}
- if(context.getSessionData(CK.REW_PERMISSION) == null)
+ if (context.getSessionData(CK.REW_PERMISSION) == null) {
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set permission rewards (None set)\n";
- else{
+ } else {
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set permission rewards\n";
List permissions = (List) context.getSessionData(CK.REW_PERMISSION);
- for(String perm : permissions){
+ for (String perm : permissions) {
text += GRAY + " - " + AQUA + perm + "\n";
}
}
- //mcMMO
+ if (Quests.mcmmo != null) {
- if(Quests.mcmmo != null){
-
- if(context.getSessionData(CK.REW_MCMMO_SKILLS) == null)
+ if (context.getSessionData(CK.REW_MCMMO_SKILLS) == null) {
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set mcMMO skill rewards (None set)\n";
- else{
+ } else {
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set mcMMO skill rewards\n";
List skills = (List) context.getSessionData(CK.REW_MCMMO_SKILLS);
List amounts = (List) context.getSessionData(CK.REW_MCMMO_AMOUNTS);
- for(String skill : skills){
+ for (String skill : skills) {
text += GRAY + " - " + AQUA + skill + GRAY + " x " + DARKAQUA + amounts.get(skills.indexOf(skill)) + "\n";
}
}
- }else{
+ } else {
text += GRAY + "8 - Set mcMMO skill rewards (mcMMO not installed)\n";
}
- //
- text += GREEN + "" + BOLD + "9" + RESET + YELLOW + " - Done";
+ if (Quests.heroes != null) {
+
+ if (context.getSessionData(CK.REW_HEROES_CLASSES) == null) {
+ text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - Set Heroes experience rewards (None set)\n";
+ } else {
+ text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - Set Heroes experience rewards\n";
+ List heroClasses = (List) context.getSessionData(CK.REW_HEROES_CLASSES);
+ List amounts = (List) context.getSessionData(CK.REW_HEROES_AMOUNTS);
+
+ for (String heroClass : heroClasses) {
+
+ text += GRAY + " - " + AQUA + amounts.get(heroClasses.indexOf(heroClass)) + " " + DARKAQUA + heroClass + " Experience\n";
+
+ }
+ }
+
+ } else {
+
+ text += GRAY + "9 - Set Heroes experience rewards (Heroes not installed)\n";
+
+ }
+
+ text += GREEN + "" + BOLD + "10" + RESET + YELLOW + " - Done";
return text;
}
@Override
- protected Prompt acceptValidatedInput(ConversationContext context, String input){
+ protected Prompt acceptValidatedInput(ConversationContext context, String input) {
- if(input.equalsIgnoreCase("1")){
+ if (input.equalsIgnoreCase("1")) {
return new MoneyPrompt();
- }else if(input.equalsIgnoreCase("2")){
+ } else if (input.equalsIgnoreCase("2")) {
return new QuestPointsPrompt();
- }else if(input.equalsIgnoreCase("3")){
+ } else if (input.equalsIgnoreCase("3")) {
return new ItemListPrompt();
- }else if(input.equalsIgnoreCase("4")){
- if(Quests.rpgItems != null)
+ } else if (input.equalsIgnoreCase("4")) {
+ if (Quests.rpgItems != null) {
return new RPGItemsPrompt();
- else
+ } else {
return new RewardsPrompt(quests, factory);
- }else if(input.equalsIgnoreCase("5")){
+ }
+ } else if (input.equalsIgnoreCase("5")) {
return new ExperiencePrompt();
- }else if(input.equalsIgnoreCase("6")){
+ } else if (input.equalsIgnoreCase("6")) {
return new CommandsPrompt();
- }else if(input.equalsIgnoreCase("7")){
+ } else if (input.equalsIgnoreCase("7")) {
return new PermissionsPrompt();
- }else if(input.equalsIgnoreCase("8")){
- if(Quests.mcmmo != null)
+ } else if (input.equalsIgnoreCase("8")) {
+ if (Quests.mcmmo != null) {
return new mcMMOListPrompt();
- else
+ } else {
return new RewardsPrompt(quests, factory);
- }else if(input.equalsIgnoreCase("9")){
+ }
+ } else if (input.equalsIgnoreCase("9")) {
+ if (Quests.heroes != null) {
+ return new HeroesListPrompt();
+ } else {
+ return new RewardsPrompt(quests, factory);
+ }
+ } else if (input.equalsIgnoreCase("10")) {
return factory.returnToMenu();
}
return null;
@@ -181,22 +207,23 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
private class MoneyPrompt extends NumericPrompt {
@Override
- public String getPromptText(ConversationContext context){
+ public String getPromptText(ConversationContext context) {
return YELLOW + "Enter amount of " + AQUA + (Quests.economy.currencyNamePlural().isEmpty() ? "Money" : Quests.economy.currencyNamePlural()) + YELLOW + ", or 0 to clear the money reward, or -1 to cancel";
}
@Override
- protected Prompt acceptValidatedInput(ConversationContext context, Number input){
+ protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
- if(input.intValue() < -1){
+ if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(RED + "Amount must be positive!");
return new MoneyPrompt();
- }else if(input.intValue() == 0)
+ } else if (input.intValue() == 0) {
context.setSessionData(CK.REW_MONEY, null);
- else if(input.intValue() != -1)
+ } else if (input.intValue() != -1) {
context.setSessionData(CK.REW_MONEY, input.intValue());
+ }
return new RewardsPrompt(quests, factory);
@@ -207,22 +234,23 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
private class ExperiencePrompt extends NumericPrompt {
@Override
- public String getPromptText(ConversationContext context){
+ public String getPromptText(ConversationContext context) {
return YELLOW + "Enter amount of experience, or 0 to clear the experience reward, or -1 to cancel";
}
@Override
- protected Prompt acceptValidatedInput(ConversationContext context, Number input){
+ protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
- if(input.intValue() < -1){
+ if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(RED + "Amount must be positive!");
return new ExperiencePrompt();
- }else if(input.intValue() == -1)
+ } else if (input.intValue() == -1) {
context.setSessionData(CK.REW_EXP, null);
- else if(input.intValue() != 0)
+ } else if (input.intValue() != 0) {
context.setSessionData(CK.REW_EXP, input.intValue());
+ }
return new RewardsPrompt(quests, factory);
@@ -233,47 +261,48 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
private class QuestPointsPrompt extends NumericPrompt {
@Override
- public String getPromptText(ConversationContext context){
+ public String getPromptText(ConversationContext context) {
return YELLOW + "Enter amount of Quest Points, or 0 to clear the Quest Points reward, or -1 to cancel";
}
@Override
- protected Prompt acceptValidatedInput(ConversationContext context, Number input){
+ protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
- if(input.intValue() < -1){
+ if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(RED + "Amount must be positive!");
return new QuestPointsPrompt();
- }else if(input.intValue() == -1)
+ } else if (input.intValue() == -1) {
context.setSessionData(CK.REW_QUEST_POINTS, null);
- else if(input.intValue() != 0)
+ } else if (input.intValue() != 0) {
context.setSessionData(CK.REW_QUEST_POINTS, input.intValue());
+ }
return new RewardsPrompt(quests, factory);
}
-
}
+
private class ItemListPrompt extends FixedSetPrompt {
- public ItemListPrompt(){
+ public ItemListPrompt() {
super("1", "2", "3");
}
@Override
- public String getPromptText(ConversationContext context){
+ public String getPromptText(ConversationContext context) {
// Check/add newly made item
- if(context.getSessionData("newItem") != null){
- if(context.getSessionData(CK.REW_ITEMS) != null){
+ if (context.getSessionData("newItem") != null) {
+ if (context.getSessionData(CK.REW_ITEMS) != null) {
List itemRews = getItems(context);
itemRews.add((ItemStack) context.getSessionData("tempStack"));
context.setSessionData(CK.REW_ITEMS, itemRews);
- }else{
+ } else {
LinkedList itemRews = new LinkedList();
itemRews.add((ItemStack) context.getSessionData("tempStack"));
context.setSessionData(CK.REW_ITEMS, itemRews);
@@ -285,18 +314,17 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}
String text = GOLD + "- Item Rewards -\n";
- if(context.getSessionData(CK.REW_ITEMS) == null){
+ if (context.getSessionData(CK.REW_ITEMS) == null) {
text += GRAY + " (" + Lang.get("noneSet") + ")\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add item\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Done";
- }else{
+ } else {
- for(ItemStack is : getItems(context)){
+ for (ItemStack is : getItems(context)) {
text += GRAY + "- " + ItemUtil.getDisplayString(is) + "\n";
-
}
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add item\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Clear\n";
@@ -309,22 +337,22 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}
@Override
- protected Prompt acceptValidatedInput(ConversationContext context, String input){
+ protected Prompt acceptValidatedInput(ConversationContext context, String input) {
- if(input.equalsIgnoreCase("1")){
+ if (input.equalsIgnoreCase("1")) {
return new ItemStackPrompt(ItemListPrompt.this);
- }else if(input.equalsIgnoreCase("2")){
+ } else if (input.equalsIgnoreCase("2")) {
context.getForWhom().sendRawMessage(YELLOW + "Item rewards cleared.");
context.setSessionData(CK.REW_ITEMS, null);
return new ItemListPrompt();
- }else if(input.equalsIgnoreCase("3")){
+ } else if (input.equalsIgnoreCase("3")) {
return new RewardsPrompt(quests, factory);
}
return null;
}
- private List getItems(ConversationContext context){
+ private List getItems(ConversationContext context) {
return (List) context.getSessionData(CK.REW_ITEMS);
}
@@ -332,30 +360,30 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
private class RPGItemsPrompt extends FixedSetPrompt {
- public RPGItemsPrompt(){
+ public RPGItemsPrompt() {
super("1", "2", "3");
}
@Override
- public String getPromptText(ConversationContext context){
+ public String getPromptText(ConversationContext context) {
String text = GOLD + "- RPGItem Rewards -\n";
- if(context.getSessionData(CK.REW_RPG_ITEM_IDS) == null){
+ if (context.getSessionData(CK.REW_RPG_ITEM_IDS) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set IDs\n";
- }else{
+ } else {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set IDs\n";
- for(Integer i : (List) context.getSessionData(CK.REW_RPG_ITEM_IDS)){
+ for (Integer i : (List) context.getSessionData(CK.REW_RPG_ITEM_IDS)) {
text += AQUA + " - " + i + "\n";
}
}
- if(context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS) == null){
+ if (context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS) == null) {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set amounts\n";
- }else{
+ } else {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set amounts\n";
- for(Integer i : (List) context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS)){
+ for (Integer i : (List) context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS)) {
text += AQUA + " - " + i + "\n";
}
}
@@ -367,30 +395,32 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}
@Override
- protected Prompt acceptValidatedInput(ConversationContext context, String input){
+ protected Prompt acceptValidatedInput(ConversationContext context, String input) {
- if(input.equalsIgnoreCase("1")){
+ if (input.equalsIgnoreCase("1")) {
return new RPGItemIdsPrompt();
- }else if(input.equalsIgnoreCase("2")){
+ } else if (input.equalsIgnoreCase("2")) {
return new RPGItemAmountsPrompt();
- }else if(input.equalsIgnoreCase("3")){
+ } else if (input.equalsIgnoreCase("3")) {
int one;
int two;
- if(context.getSessionData(CK.REW_RPG_ITEM_IDS) != null)
+ if (context.getSessionData(CK.REW_RPG_ITEM_IDS) != null) {
one = ((List) context.getSessionData(CK.REW_RPG_ITEM_IDS)).size();
- else
+ } else {
one = 0;
+ }
- if(context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS) != null)
+ if (context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS) != null) {
two = ((List) context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS)).size();
- else
+ } else {
two = 0;
+ }
- if(one == two)
+ if (one == two) {
return new RewardsPrompt(quests, factory);
- else{
+ } else {
context.getForWhom().sendRawMessage(RED + "The " + GOLD + "IDs list " + RED + "and " + GOLD + "amounts list " + RED + "are not the same size!");
return new RPGItemsPrompt();
}
@@ -405,46 +435,45 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
private class RPGItemIdsPrompt extends StringPrompt {
@Override
- public String getPromptText(ConversationContext context){
+ public String getPromptText(ConversationContext context) {
return YELLOW + "Enter RPGItem IDs (or names) separating each one by a space, or enter \'clear\' to clear the list, or \'cancel\' to return.";
}
@Override
- public Prompt acceptInput(ConversationContext context, String input){
+ public Prompt acceptInput(ConversationContext context, String input) {
- if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
+ if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
String[] args = input.split(" ");
LinkedList ids = new LinkedList();
- for(String s : args){
+ for (String s : args) {
- try{
+ try {
int id = Integer.parseInt(s);
- if(ids.contains(id)){
+ if (ids.contains(id)) {
context.getForWhom().sendRawMessage(RED + "Error: List contains duplicates!");
return new RPGItemIdsPrompt();
}
-
RPGItem item = ItemManager.getItemById(id);
- if(item != null){
+ if (item != null) {
ids.add(id);
- }else {
+ } else {
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ", not an RPGItem ID or name!");
return new RPGItemIdsPrompt();
}
- }catch (NumberFormatException e){
+ } catch (NumberFormatException e) {
RPGItem item = ItemManager.getItemByName(s);
- if(item == null){
+ if (item == null) {
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ", not an RPGItem ID or name!");
return new RPGItemIdsPrompt();
- }else{
+ } else {
ids.add(item.getID());
}
}
@@ -453,7 +482,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
context.setSessionData(CK.REW_RPG_ITEM_IDS, ids);
- }else if(input.equalsIgnoreCase("clear")){
+ } else if (input.equalsIgnoreCase("clear")) {
context.setSessionData(CK.REW_RPG_ITEM_IDS, null);
context.getForWhom().sendRawMessage(YELLOW + "RPGItem IDs cleared.");
@@ -469,29 +498,29 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
private class RPGItemAmountsPrompt extends StringPrompt {
@Override
- public String getPromptText(ConversationContext context){
+ public String getPromptText(ConversationContext context) {
return YELLOW + "Enter RPGItem amounts (numbers) separating each one by a space, or enter \'clear\' to clear the list, or \'cancel\' to return.";
}
@Override
- public Prompt acceptInput(ConversationContext context, String input){
+ public Prompt acceptInput(ConversationContext context, String input) {
- if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
+ if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
String[] args = input.split(" ");
LinkedList amounts = new LinkedList();
- for(String s : args){
+ for (String s : args) {
- try{
+ try {
- if(Integer.parseInt(s) > 0)
+ if (Integer.parseInt(s) > 0) {
amounts.add(Integer.parseInt(s));
- else{
+ } else {
context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!");
return new RPGItemAmountsPrompt();
}
- }catch (NumberFormatException e){
+ } catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
return new RPGItemAmountsPrompt();
}
@@ -500,7 +529,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
context.setSessionData(CK.REW_RPG_ITEM_AMOUNTS, amounts);
- }else if(input.equalsIgnoreCase("clear")){
+ } else if (input.equalsIgnoreCase("clear")) {
context.setSessionData(CK.REW_RPG_ITEM_AMOUNTS, null);
context.getForWhom().sendRawMessage(YELLOW + "RPGItem amounts cleared.");
@@ -511,28 +540,28 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}
-
}
private class CommandsPrompt extends StringPrompt {
@Override
- public String getPromptText(ConversationContext context){
+ public String getPromptText(ConversationContext context) {
String note = GOLD + "\nNote: You may put to specify the player who completed the Quest. e.g. " + AQUA + BOLD + ITALIC + "smite " + RESET;
return YELLOW + "Enter command rewards separating each one by a " + BOLD + "comma" + RESET + YELLOW + ", or enter \'clear\' to clear the list, or enter \'cancel\' to return." + note;
}
@Override
- public Prompt acceptInput(ConversationContext context, String input){
+ public Prompt acceptInput(ConversationContext context, String input) {
- if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
+ if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
String[] args = input.split(",");
LinkedList commands = new LinkedList();
- for(String s : args){
+ for (String s : args) {
- if(s.startsWith("/"))
+ if (s.startsWith("/")) {
s = s.substring(1);
+ }
commands.add(s);
@@ -540,7 +569,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
context.setSessionData(CK.REW_COMMAND, commands);
- }else if(input.equalsIgnoreCase("clear")){
+ } else if (input.equalsIgnoreCase("clear")) {
context.setSessionData(CK.REW_COMMAND, null);
}
@@ -553,14 +582,14 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
private class PermissionsPrompt extends StringPrompt {
@Override
- public String getPromptText(ConversationContext context){
+ public String getPromptText(ConversationContext context) {
return YELLOW + "Enter permission rewards separating each one by a space, or enter \'clear\' to clear the list, or enter \'cancel\' to return.";
}
@Override
- public Prompt acceptInput(ConversationContext context, String input){
+ public Prompt acceptInput(ConversationContext context, String input) {
- if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
+ if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
String[] args = input.split(" ");
LinkedList permissions = new LinkedList();
@@ -568,7 +597,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
context.setSessionData(CK.REW_PERMISSION, permissions);
- }else if(input.equalsIgnoreCase("clear")){
+ } else if (input.equalsIgnoreCase("clear")) {
context.setSessionData(CK.REW_PERMISSION, null);
}
@@ -578,44 +607,39 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}
-
-
-
-
//mcMMO
-
private class mcMMOListPrompt extends FixedSetPrompt {
- public mcMMOListPrompt(){
+ public mcMMOListPrompt() {
super("1", "2", "3", "4");
}
@Override
- public String getPromptText(ConversationContext context){
+ public String getPromptText(ConversationContext context) {
String text = GOLD + "- mcMMO Rewards -\n";
- if(context.getSessionData(CK.REW_MCMMO_SKILLS) == null){
+ if (context.getSessionData(CK.REW_MCMMO_SKILLS) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set skills (None set)\n";
text += GRAY + "2 - Set skill amounts (No skills set)\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done";
- }else{
+ } else {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set skills\n";
- for(String s : getSkills(context)){
+ for (String s : getSkills(context)) {
text += GRAY + " - " + AQUA + s + "\n";
}
- if(context.getSessionData(CK.REW_MCMMO_AMOUNTS) == null){
+ if (context.getSessionData(CK.REW_MCMMO_AMOUNTS) == null) {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set skill amounts (None set)\n";
- }else{
+ } else {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set skill amounts\n";
- for(Integer i : getSkillAmounts(context)){
+ for (Integer i : getSkillAmounts(context)) {
text += GRAY + " - " + AQUA + i + "\n";
@@ -633,40 +657,42 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}
@Override
- protected Prompt acceptValidatedInput(ConversationContext context, String input){
+ protected Prompt acceptValidatedInput(ConversationContext context, String input) {
- if(input.equalsIgnoreCase("1")){
+ if (input.equalsIgnoreCase("1")) {
return new mcMMOSkillsPrompt();
- }else if(input.equalsIgnoreCase("2")){
- if(context.getSessionData(CK.REW_MCMMO_SKILLS) == null){
+ } else if (input.equalsIgnoreCase("2")) {
+ if (context.getSessionData(CK.REW_MCMMO_SKILLS) == null) {
context.getForWhom().sendRawMessage(RED + "You must set skills first!");
return new mcMMOListPrompt();
- }else{
+ } else {
return new mcMMOAmountsPrompt();
}
- }else if(input.equalsIgnoreCase("3")){
+ } else if (input.equalsIgnoreCase("3")) {
context.getForWhom().sendRawMessage(YELLOW + "mcMMO rewards cleared.");
context.setSessionData(CK.REW_MCMMO_SKILLS, null);
context.setSessionData(CK.REW_MCMMO_AMOUNTS, null);
return new mcMMOListPrompt();
- }else if(input.equalsIgnoreCase("4")){
+ } else if (input.equalsIgnoreCase("4")) {
int one;
int two;
- if(context.getSessionData(CK.REW_MCMMO_SKILLS) != null)
+ if (context.getSessionData(CK.REW_MCMMO_SKILLS) != null) {
one = ((List) context.getSessionData(CK.REW_MCMMO_SKILLS)).size();
- else
+ } else {
one = 0;
+ }
- if(context.getSessionData(CK.REW_MCMMO_AMOUNTS) != null)
+ if (context.getSessionData(CK.REW_MCMMO_AMOUNTS) != null) {
two = ((List) context.getSessionData(CK.REW_MCMMO_AMOUNTS)).size();
- else
+ } else {
two = 0;
+ }
- if(one == two)
+ if (one == two) {
return new RewardsPrompt(quests, factory);
- else{
+ } else {
context.getForWhom().sendRawMessage(RED + "The " + GOLD + "skills list " + RED + "and " + GOLD + "skill amounts list " + RED + "are not the same size!");
return new mcMMOListPrompt();
}
@@ -675,11 +701,11 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}
- private List getSkills(ConversationContext context){
+ private List getSkills(ConversationContext context) {
return (List) context.getSessionData(CK.REW_MCMMO_SKILLS);
}
- private List getSkillAmounts(ConversationContext context){
+ private List getSkillAmounts(ConversationContext context) {
return (List) context.getSessionData(CK.REW_MCMMO_AMOUNTS);
}
@@ -688,47 +714,47 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
private class mcMMOSkillsPrompt extends StringPrompt {
@Override
- public String getPromptText(ConversationContext context){
- String skillList =
- GOLD + "-Skill List-\n" +
- AQUA + "Acrobatics\n" +
- GRAY + "All\n" +
- AQUA + "Archery\n" +
- AQUA + "Axes\n" +
- AQUA + "Excavation\n" +
- AQUA + "Fishing\n" +
- AQUA + "Herbalism\n" +
- AQUA + "Mining\n" +
- AQUA + "Repair\n" +
- AQUA + "Smelting\n" +
- AQUA + "Swords\n" +
- AQUA + "Taming\n" +
- AQUA + "Unarmed\n" +
- AQUA + "Woodcutting\n\n";
+ public String getPromptText(ConversationContext context) {
+ String skillList
+ = GOLD + "-Skill List-\n"
+ + AQUA + "Acrobatics\n"
+ + GRAY + "All\n"
+ + AQUA + "Archery\n"
+ + AQUA + "Axes\n"
+ + AQUA + "Excavation\n"
+ + AQUA + "Fishing\n"
+ + AQUA + "Herbalism\n"
+ + AQUA + "Mining\n"
+ + AQUA + "Repair\n"
+ + AQUA + "Smelting\n"
+ + AQUA + "Swords\n"
+ + AQUA + "Taming\n"
+ + AQUA + "Unarmed\n"
+ + AQUA + "Woodcutting\n\n";
return skillList + YELLOW + "Enter mcMMO skills, separating each one by a space, or enter \'cancel\' to return."
+ "\n" + GOLD + "Note: The \'All\' option will give levels to all skills.";
}
@Override
- public Prompt acceptInput(ConversationContext context, String input){
+ public Prompt acceptInput(ConversationContext context, String input) {
- if(input.equalsIgnoreCase("cancel") == false){
+ if (input.equalsIgnoreCase("cancel") == false) {
String[] args = input.split(" ");
LinkedList skills = new LinkedList();
- for(String s : args){
+ for (String s : args) {
- if(Quests.getMcMMOSkill(s) != null){
+ if (Quests.getMcMMOSkill(s) != null) {
- if(skills.contains(s) == false){
+ if (skills.contains(s) == false) {
skills.add(Quester.getCapitalized(s));
- }else{
+ } else {
context.getForWhom().sendRawMessage(RED + "List contains duplicates!");
return new mcMMOSkillsPrompt();
}
- }else{
+ } else {
context.getForWhom().sendRawMessage(PINK + s + RED + " is not a valid mcMMO skill!");
return new mcMMOSkillsPrompt();
}
@@ -748,29 +774,29 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
private class mcMMOAmountsPrompt extends StringPrompt {
@Override
- public String getPromptText(ConversationContext context){
+ public String getPromptText(ConversationContext context) {
return YELLOW + "Enter skill amounts (numbers), separating each one by a space, or enter \'cancel\' to return.";
}
@Override
- public Prompt acceptInput(ConversationContext context, String input){
+ public Prompt acceptInput(ConversationContext context, String input) {
- if(input.equalsIgnoreCase("cancel") == false){
+ if (input.equalsIgnoreCase("cancel") == false) {
String[] args = input.split(" ");
LinkedList amounts = new LinkedList();
- for(String s : args){
+ for (String s : args) {
- try{
+ try {
- if(Integer.parseInt(s) > 0)
+ if (Integer.parseInt(s) > 0) {
amounts.add(Integer.parseInt(s));
- else{
+ } else {
context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!");
return new mcMMOAmountsPrompt();
}
- }catch (NumberFormatException e){
+ } catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
return new mcMMOAmountsPrompt();
}
@@ -785,7 +811,219 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}
+ }
+
+ private class HeroesListPrompt extends FixedSetPrompt {
+
+ public HeroesListPrompt() {
+
+ super("1", "2", "3", "4");
+
+ }
+
+ @Override
+ public String getPromptText(ConversationContext context) {
+
+ String text = GOLD + "- Heroes Rewards -\n";
+ if (context.getSessionData(CK.REW_HEROES_CLASSES) == null) {
+ text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set classes (None set)\n";
+ text += GRAY + "2 - Set experience amounts (No classes set)\n";
+ text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n";
+ text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done";
+ } else {
+
+ text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set classes\n";
+ for (String s : getClasses(context)) {
+
+ text += GRAY + " - " + AQUA + s + "\n";
+
+ }
+
+ if (context.getSessionData(CK.REW_HEROES_AMOUNTS) == null) {
+ text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set experience amounts (None set)\n";
+ } else {
+
+ text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set experience amounts\n";
+ for (Double d : getClassAmounts(context)) {
+
+ text += GRAY + " - " + AQUA + d + "\n";
+
+ }
+
+ }
+
+ text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n";
+ text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done";
+
+ }
+
+ return text;
+
+ }
+
+ @Override
+ protected Prompt acceptValidatedInput(ConversationContext context, String input) {
+
+ if (input.equalsIgnoreCase("1")) {
+ return new HeroesClassesPrompt();
+ } else if (input.equalsIgnoreCase("2")) {
+ if (context.getSessionData(CK.REW_HEROES_CLASSES) == null) {
+ context.getForWhom().sendRawMessage(RED + "You must set classes first!");
+ return new HeroesListPrompt();
+ } else {
+ return new HeroesExperiencePrompt();
+ }
+ } else if (input.equalsIgnoreCase("3")) {
+ context.getForWhom().sendRawMessage(YELLOW + "Heroes rewards cleared.");
+ context.setSessionData(CK.REW_HEROES_CLASSES, null);
+ context.setSessionData(CK.REW_HEROES_AMOUNTS, null);
+ return new HeroesListPrompt();
+ } else if (input.equalsIgnoreCase("4")) {
+
+ int one;
+ int two;
+
+ if (context.getSessionData(CK.REW_HEROES_CLASSES) != null) {
+ one = ((List) context.getSessionData(CK.REW_HEROES_CLASSES)).size();
+ } else {
+ one = 0;
+ }
+
+ if (context.getSessionData(CK.REW_HEROES_AMOUNTS) != null) {
+ two = ((List) context.getSessionData(CK.REW_HEROES_AMOUNTS)).size();
+ } else {
+ two = 0;
+ }
+
+ if (one == two) {
+ return new RewardsPrompt(quests, factory);
+ } else {
+ context.getForWhom().sendRawMessage(RED + "The " + GOLD + "classes list " + RED + "and " + GOLD + "experience amounts list " + RED + "are not the same size!");
+ return new HeroesListPrompt();
+ }
+ }
+ return null;
+
+ }
+
+ private List getClasses(ConversationContext context) {
+ return (List) context.getSessionData(CK.REW_HEROES_CLASSES);
+ }
+
+ private List getClassAmounts(ConversationContext context) {
+ return (List) context.getSessionData(CK.REW_HEROES_AMOUNTS);
+ }
}
+ private class HeroesClassesPrompt extends StringPrompt {
+
+ @Override
+ public String getPromptText(ConversationContext cc) {
+
+ String text = PURPLE + "- " + PINK + "Heroes Classes" + PURPLE + " -\n";
+ LinkedList list = new LinkedList();
+ for (HeroClass hc : Quests.heroes.getClassManager().getClasses()) {
+ list.add(hc.getName());
+ }
+
+ if (list.isEmpty()) {
+ text += GRAY + "(None)";
+ } else {
+
+ Collections.sort(list);
+
+ for (String s : list) {
+ text += PINK + s + ", ";
+ }
+
+ text = text.substring(0, text.length() - 2) + "\n";
+
+ }
+
+ text += YELLOW + "Enter Heroes classes separating each one by a space, or enter \"cancel\" to return.";
+
+ return text;
+ }
+
+ @Override
+ public Prompt acceptInput(ConversationContext cc, String input) {
+
+ if (input.equalsIgnoreCase("cancel") == false) {
+
+ String[] arr = input.split(" ");
+ LinkedList classes = new LinkedList();
+
+ for (String s : arr) {
+
+ HeroClass hc = Quests.heroes.getClassManager().getClass(s);
+ if (hc == null) {
+ cc.getForWhom().sendRawMessage(RED + "Error: " + PINK + s + RED + " is not a valid Heroes class name!");
+ return new HeroesClassesPrompt();
+ } else {
+ classes.add(hc.getName());
+ }
+
+ }
+
+ cc.setSessionData(CK.REW_HEROES_CLASSES, classes);
+
+ return new HeroesListPrompt();
+
+ } else {
+ return new HeroesListPrompt();
+ }
+
+ }
+ }
+
+ private class HeroesExperiencePrompt extends StringPrompt {
+
+ @Override
+ public String getPromptText(ConversationContext cc) {
+
+ String text = PURPLE + "- " + PINK + "Heroes Experience" + PURPLE + " -\n";
+
+ text += YELLOW + "Enter experience amounts (numbers, decimals are allowed) separating each one by a space, or enter \"cancel\" to return.";
+
+ return text;
+ }
+
+ @Override
+ public Prompt acceptInput(ConversationContext cc, String input) {
+
+ if (input.equalsIgnoreCase("cancel") == false) {
+
+ String[] arr = input.split(" ");
+ LinkedList amounts = new LinkedList();
+
+ for (String s : arr) {
+
+ try {
+
+ double d = Double.parseDouble(s);
+ if (d > 0) {
+ amounts.add(d);
+ } else {
+ cc.getForWhom().sendRawMessage(RED + "Error: " + PINK + s + RED + " is not greater than zero!");
+ return new HeroesExperiencePrompt();
+ }
+
+ } catch (NumberFormatException nfe) {
+ cc.getForWhom().sendRawMessage(RED + "Error: " + PINK + s + RED + " is not a number!");
+ return new HeroesExperiencePrompt();
+ }
+
+ }
+
+ cc.setSessionData(CK.REW_HEROES_AMOUNTS, amounts);
+ return new HeroesListPrompt();
+
+ } else {
+ return new HeroesListPrompt();
+ }
+
+ }
+ }
+
}
diff --git a/src/main/java/me/blackvein/quests/prompts/StagesPrompt.java b/src/main/java/me/blackvein/quests/prompts/StagesPrompt.java
index 972a38715..ca00aa39c 100644
--- a/src/main/java/me/blackvein/quests/prompts/StagesPrompt.java
+++ b/src/main/java/me/blackvein/quests/prompts/StagesPrompt.java
@@ -1,6 +1,6 @@
package me.blackvein.quests.prompts;
-import me.blackvein.quests.ColorUtil;
+import me.blackvein.quests.util.ColorUtil;
import me.blackvein.quests.QuestFactory;
import me.blackvein.quests.util.CK;
import me.blackvein.quests.util.Lang;
diff --git a/src/main/java/me/blackvein/quests/util/CK.java b/src/main/java/me/blackvein/quests/util/CK.java
index 9f79880c6..63f7d1242 100644
--- a/src/main/java/me/blackvein/quests/util/CK.java
+++ b/src/main/java/me/blackvein/quests/util/CK.java
@@ -22,10 +22,10 @@ public class CK {
public static final String REQ_ITEMS = "itemReqs";
public static final String REQ_ITEMS_REMOVE = "removeItemReqs";
public static final String REQ_PERMISSION = "permissionReqs";
- public static final String REQ_MCMMO_SKILLS = "mcMMOSkillReqs";
- public static final String REQ_MCMMO_SKILL_AMOUNTS = "mcMMOSkillAmountReqs";
- public static final String REQ_HEROES_PRIMARY_CLASS = "heroesPrimaryClassReq";
- public static final String REQ_HEROES_SECONDARY_CLASS = "heroesSecondaryClassReq";
+ public static final String REQ_MCMMO_SKILLS = "mcMMOSkillReqs";
+ public static final String REQ_MCMMO_SKILL_AMOUNTS = "mcMMOSkillAmountReqs";
+ public static final String REQ_HEROES_PRIMARY_CLASS = "heroesPrimaryClassReq";
+ public static final String REQ_HEROES_SECONDARY_CLASS = "heroesSecondaryClassReq";
public static final String REQ_QUEST = "questReqs";
public static final String REQ_QUEST_BLOCK= "questBlocks";
@@ -40,6 +40,8 @@ public class CK {
public static final String REW_PERMISSION = "permissionRews";
public static final String REW_MCMMO_SKILLS = "mcMMOSkillRews";
public static final String REW_MCMMO_AMOUNTS = "mcMMOSkillAmounts";
+ public static final String REW_HEROES_CLASSES = "heroesClassRews";
+ public static final String REW_HEROES_AMOUNTS = "heroesAmountRews";
//Stages
public static final String S_BREAK_IDS = "breakIds";
diff --git a/src/main/java/me/blackvein/quests/util/ColorUtil.java b/src/main/java/me/blackvein/quests/util/ColorUtil.java
new file mode 100644
index 000000000..8fac13653
--- /dev/null
+++ b/src/main/java/me/blackvein/quests/util/ColorUtil.java
@@ -0,0 +1,31 @@
+package me.blackvein.quests.util;
+
+import org.bukkit.ChatColor;
+
+public interface ColorUtil {
+
+ static final ChatColor BOLD = ChatColor.BOLD;
+ static final ChatColor ITALIC = ChatColor.ITALIC;
+ static final ChatColor UNDERLINE = ChatColor.UNDERLINE;
+ static final ChatColor STRIKETHROUGH = ChatColor.STRIKETHROUGH;
+ static final ChatColor MAGIC = ChatColor.MAGIC;
+ static final ChatColor RESET = ChatColor.RESET;
+ static final ChatColor WHITE = ChatColor.WHITE;
+ static final ChatColor BLACK = ChatColor.BLACK;
+ static final ChatColor AQUA = ChatColor.AQUA;
+ static final ChatColor DARKAQUA = ChatColor.DARK_AQUA;
+ static final ChatColor BLUE = ChatColor.BLUE;
+ static final ChatColor DARKBLUE = ChatColor.DARK_BLUE;
+ static final ChatColor GOLD = ChatColor.GOLD;
+ static final ChatColor GRAY = ChatColor.GRAY;
+ static final ChatColor DARKGRAY = ChatColor.DARK_GRAY;
+ static final ChatColor PINK = ChatColor.LIGHT_PURPLE;
+ static final ChatColor PURPLE = ChatColor.DARK_PURPLE;
+ static final ChatColor GREEN = ChatColor.GREEN;
+ static final ChatColor DARKGREEN = ChatColor.DARK_GREEN;
+ static final ChatColor RED = ChatColor.RED;
+ static final ChatColor DARKRED = ChatColor.DARK_RED;
+ static final ChatColor YELLOW = ChatColor.YELLOW;
+
+
+}
diff --git a/src/main/java/me/blackvein/quests/util/ItemUtil.java b/src/main/java/me/blackvein/quests/util/ItemUtil.java
index 122a2c593..2e45ac4a4 100644
--- a/src/main/java/me/blackvein/quests/util/ItemUtil.java
+++ b/src/main/java/me/blackvein/quests/util/ItemUtil.java
@@ -2,7 +2,6 @@ package me.blackvein.quests.util;
import java.util.LinkedList;
import java.util.Map.Entry;
-import me.blackvein.quests.ColorUtil;
import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests;
import org.bukkit.ChatColor;