This commit is contained in:
Blackvein 2013-04-12 14:04:19 -07:00
parent 2be6b0ffb5
commit a2caa24e4f
16 changed files with 411 additions and 113 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/lib/Quests/build/
/lib/Quests/dist/
/lib/Quests/nbproject/private/

0
README.md Normal file → Executable file
View File

148
build.xml Normal file → Executable file
View File

@ -1,74 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="Quests" default="default" basedir=".">
<description>Builds, tests, and runs the project Quests.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="Quests-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="Quests" default="default" basedir=".">
<description>Builds, tests, and runs the project Quests.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="Quests-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

BIN
lib/CitizensAPI-2.0.8.jar Executable file

Binary file not shown.

BIN
lib/ProtocolLib-2.4.1.jar Normal file

Binary file not shown.

BIN
lib/Vault.jar Normal file → Executable file

Binary file not shown.

BIN
lib/bukkit-1.5.1-R0.1.jar Executable file

Binary file not shown.

BIN
lib/denizen-0.8.8-PRERELEASE.jar Executable file

Binary file not shown.

BIN
lib/mcMMO.jar Normal file → Executable file

Binary file not shown.

0
manifest.mf Normal file → Executable file
View File

View File

@ -1,14 +1,17 @@
package me.blackvein.quests;
import net.citizensnpcs.api.event.NPCDespawnEvent;
import net.citizensnpcs.api.event.NPCDeathEvent;
import net.citizensnpcs.api.event.NPCRightClickEvent;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.ChatColor;
import org.bukkit.conversations.Conversable;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.ItemStack;
public class NpcListener implements Listener {
@ -27,26 +30,26 @@ public class NpcListener implements Listener {
final Player player = evt.getClicker();
final Quester quester = plugin.getQuester(player.getName());
boolean delivery = false;
if(quester.hasObjective("deliverItem") && player.getItemInHand() != null){
if (quester.hasObjective("deliverItem") && player.getItemInHand() != null) {
ItemStack hand = player.getItemInHand();
if(quester.itemsDelivered.containsKey(hand.getType())){
if (quester.itemsDelivered.containsKey(hand.getType())) {
NPC clicked = evt.getNPC();
for(NPC n : quester.currentStage.itemDeliveryTargets){
if(n.getId() == clicked.getId()){
for (NPC n : quester.currentStage.itemDeliveryTargets) {
if (n.getId() == clicked.getId()) {
quester.deliverItem(hand);
delivery = true;
break;
}
}
}
}
if (plugin.questNPCs.contains(evt.getNPC()) && delivery == false) {
if (plugin.checkQuester(player.getName()) == false) {
@ -89,16 +92,16 @@ public class NpcListener implements Listener {
player.sendMessage(ChatColor.YELLOW + "You may not take " + ChatColor.AQUA + q.name + ChatColor.YELLOW + " again for another " + ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW + ".");
} else if (quester.completedQuests.contains(q.name) && q.redoDelay < 0) {
player.sendMessage(ChatColor.YELLOW + "You have already completed " + ChatColor.AQUA + q.name + ChatColor.YELLOW + ".");
}else{
} else {
quester.questToTake = q.name;
String s =
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
+ "\n"
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
+ "\n"
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
player.sendMessage(s);
plugin.conversationFactory.buildConversation((Conversable) player).begin();
}
@ -125,6 +128,49 @@ public class NpcListener implements Listener {
}
@EventHandler
public void onNPCDespawn(NPCDespawnEvent evt) {
public void onNPCDeath(NPCDeathEvent evt) {
if (evt.getNPC().getBukkitEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getNPC().getBukkitEntity().getLastDamageCause();
Entity damager = damageEvent.getDamager();
if (damager != null) {
if (damager instanceof Projectile) {
Projectile p = (Projectile) damager;
if (p.getShooter() instanceof Player) {
Player player = (Player) p.getShooter();
if (plugin.checkQuester(player.getName()) == false) {
Quester quester = plugin.getQuester(player.getName());
if (quester.hasObjective("killNPC")) {
quester.killNPC(evt.getNPC());
}
}
}
} else if (damager instanceof Player) {
Player player = (Player) damager;
if (plugin.checkQuester(player.getName()) == false) {
Quester quester = plugin.getQuester(player.getName());
if (quester.hasObjective("killNPC")) {
quester.killNPC(evt.getNPC());
}
}
}
}
}
}
}

View File

@ -853,6 +853,9 @@ public class QuestFactory implements ConversationAbandonedListener {
LinkedList<String> shearColors;
LinkedList<Integer> shearAmounts;
LinkedList<Integer> npcKillIds;
LinkedList<Integer> npcKillAmounts;
String script;
String event;
@ -908,6 +911,9 @@ public class QuestFactory implements ConversationAbandonedListener {
shearColors = null;
shearAmounts = null;
npcKillIds = null;
npcKillAmounts = null;
script = null;
event = null;
@ -985,6 +991,11 @@ public class QuestFactory implements ConversationAbandonedListener {
shearColors = (LinkedList<String>) cc.getSessionData(pref + "shearColors");
shearAmounts = (LinkedList<Integer>) cc.getSessionData(pref + "shearAmounts");
}
if (cc.getSessionData(pref + "npcIdsToKill") != null) {
npcKillIds = (LinkedList<Integer>) cc.getSessionData(pref + "npcIdsToKill");
npcKillAmounts = (LinkedList<Integer>) cc.getSessionData(pref + "npcAmountsToKill");
}
if (cc.getSessionData(pref + "event") != null) {
event = (String) cc.getSessionData(pref + "event");
@ -1031,6 +1042,8 @@ public class QuestFactory implements ConversationAbandonedListener {
stage.set("mob-tame-amounts", tameAmounts);
stage.set("sheep-to-shear", shearColors);
stage.set("sheep-amounts", shearAmounts);
stage.set("npc-ids-to-kill", npcKillIds);
stage.set("npc-kill-amounts", npcKillAmounts);
stage.set("script-to-run", script);
stage.set("event", event);
stage.set("delay", delay);

View File

@ -363,7 +363,7 @@ public class Quester {
if (((Boolean) e.getValue()) == false) {
unfinishedObjectives.add(ChatColor.GREEN + "Talk to " + n.getFullName());
unfinishedObjectives.add(ChatColor.GREEN + "Talk to " + n.getName());
} else {
@ -383,7 +383,7 @@ public class Quester {
if (citizenNumKilled.get(citizensKilled.indexOf(n2)) < currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n))) {
unfinishedObjectives.add(ChatColor.GREEN + "Kill " + n.getFullName() + ChatColor.GREEN + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)) + "/" + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)));
unfinishedObjectives.add(ChatColor.GREEN + "Kill " + n.getName() + ChatColor.GREEN + citizenNumKilled.get(currentStage.citizensToKill.indexOf(n)) + "/" + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)));
} else {
@ -589,6 +589,14 @@ public class Quester {
return true;
}
} else if (s.equalsIgnoreCase("killNPC")) {
if (currentStage.citizensToKill.isEmpty()) {
return false;
} else {
return true;
}
} else if (s.equalsIgnoreCase("tameMob")) {
if (currentStage.mobsToTame.isEmpty()) {

View File

@ -46,7 +46,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
public CreateStagePrompt(int stageNum, QuestFactory qf, CitizensPlugin cit) {
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20");
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21");
this.stageNum = stageNum;
this.pref = "stage" + stageNum;
this.citizens = cit;
@ -278,43 +278,63 @@ public class CreateStagePrompt extends FixedSetPrompt {
}
}
if(questFactory.quests.citizens != null){
if (context.getSessionData(pref + "npcIdsToKill") == null) {
text += PINK + "" + BOLD + "15 " + RESET + PURPLE + "- Kill NPCs " + GRAY + "(None set)\n";
} else {
text += PINK + "" + BOLD + "15 " + RESET + PURPLE + "- Kill NPCs\n";
LinkedList<Integer> npcs = (LinkedList<Integer>) context.getSessionData(pref + "npcIdsToKill");
LinkedList<Integer> amounts = (LinkedList<Integer>) context.getSessionData(pref + "npcAmountsToKill");
for (int i = 0; i < npcs.size(); i++) {
text += GRAY + " - " + BLUE + citizens.getNPCRegistry().getById(npcs.get(i)).getName() + GRAY + " x " + AQUA + amounts.get(i) + "\n";
}
}
}else{
text += GRAY + "" + BOLD + "15 " + RESET + GRAY + "- Kill NPCs " + GRAY + "(Citizens not installed)\n";
}
if (context.getSessionData(pref + "event") == null) {
text += PINK + "" + BOLD + "15 " + RESET + PURPLE + "- Event " + GRAY + "(None set)\n";
text += PINK + "" + BOLD + "16 " + RESET + PURPLE + "- Event " + GRAY + "(None set)\n";
} else {
text += PINK + "" + BOLD + "15 " + RESET + PURPLE + "- Event " + GRAY + "(" + AQUA + context.getSessionData(pref + "event") + GRAY + ")\n";
text += PINK + "" + BOLD + "16 " + RESET + PURPLE + "- Event " + GRAY + "(" + AQUA + context.getSessionData(pref + "event") + GRAY + ")\n";
}
if (context.getSessionData(pref + "delay") == null) {
text += PINK + "" + BOLD + "16 " + RESET + PURPLE + "- Delay " + GRAY + "(None set)\n";
text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- Delay " + GRAY + "(None set)\n";
} else {
long time = (Long) context.getSessionData(pref + "delay");
text += PINK + "" + BOLD + "16 " + RESET + PURPLE + "- Delay " + GRAY + "(" + AQUA + Quests.getTime(time) + GRAY + ")\n";
text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- Delay " + GRAY + "(" + AQUA + Quests.getTime(time) + GRAY + ")\n";
}
if(context.getSessionData(pref + "delay") == null){
text += GRAY + "" + BOLD + "17 " + RESET + GRAY + "- Delay Message " + GRAY + "(No delay set)\n";
text += GRAY + "" + BOLD + "18 " + RESET + GRAY + "- Delay Message " + GRAY + "(No delay set)\n";
}else if(context.getSessionData(pref + "delayMessage") == null){
text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- Delay Message " + GRAY + "(None set)\n";
text += PINK + "" + BOLD + "18 " + RESET + PURPLE + "- Delay Message " + GRAY + "(None set)\n";
}else{
text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- Delay Message " + GRAY + "(" + AQUA + "\"" + context.getSessionData(pref + "delayMessage") + "\"" + GRAY + ")\n";
text += PINK + "" + BOLD + "18 " + RESET + PURPLE + "- Delay Message " + GRAY + "(" + AQUA + "\"" + context.getSessionData(pref + "delayMessage") + "\"" + GRAY + ")\n";
}
if(questFactory.quests.denizen == null){
text += GRAY + "" + BOLD + "18 " + RESET + GRAY + "- Denizen Script " + GRAY + "(Denizen not installed)\n";
text += GRAY + "" + BOLD + "19 " + RESET + GRAY + "- Denizen Script " + GRAY + "(Denizen not installed)\n";
}else{
if(context.getSessionData(pref + "denizen") == null){
text += GRAY + "" + BOLD + "18 " + RESET + PURPLE + "- Denizen Script " + GRAY + "(None set)\n";
text += GRAY + "" + BOLD + "19 " + RESET + PURPLE + "- Denizen Script " + GRAY + "(None set)\n";
}else{
text += PINK + "" + BOLD + "18 " + RESET + PURPLE + "- Denizen Script " + GRAY + "(" + AQUA + context.getSessionData(pref + "denizen") + GRAY + "\n";
text += PINK + "" + BOLD + "19 " + RESET + PURPLE + "- Denizen Script " + GRAY + "(" + AQUA + context.getSessionData(pref + "denizen") + GRAY + "\n";
}
}
text += RED + "" + BOLD + "19 " + RESET + PURPLE + "- Delete Stage\n";
text += GREEN + "" + BOLD + "20 " + RESET + PURPLE + "- Done\n";
text += RED + "" + BOLD + "20 " + RESET + PURPLE + "- Delete Stage\n";
text += GREEN + "" + BOLD + "21 " + RESET + PURPLE + "- Done\n";
return text;
@ -362,24 +382,31 @@ public class CreateStagePrompt extends FixedSetPrompt {
} else if (input.equalsIgnoreCase("14")) {
return new ShearListPrompt();
} else if (input.equalsIgnoreCase("15")) {
return new EventPrompt();
if(questFactory.quests.citizens != null)
return new NPCKillListPrompt();
else{
context.getForWhom().sendRawMessage(RED + "Citizens is not installed!");
return new CreateStagePrompt(stageNum, questFactory, citizens);
}
} else if (input.equalsIgnoreCase("16")) {
return new DelayPrompt();
return new EventPrompt();
} else if (input.equalsIgnoreCase("17")) {
return new DelayPrompt();
} else if (input.equalsIgnoreCase("18")) {
if(context.getSessionData(pref + "delay") == null){
context.getForWhom().sendRawMessage(RED + "You must set a delay first!");
return new CreateStagePrompt(stageNum, questFactory, citizens);
}else
return new DelayMessagePrompt();
} else if (input.equalsIgnoreCase("18")) {
} else if (input.equalsIgnoreCase("19")) {
if(questFactory.quests.denizen == null){
context.getForWhom().sendRawMessage(RED + "Denizen is not installed!");
return new CreateStagePrompt(stageNum, questFactory, citizens);
}else
return new DenizenPrompt();
} else if (input.equalsIgnoreCase("19")) {
return new DeletePrompt();
} else if (input.equalsIgnoreCase("20")) {
return new DeletePrompt();
} else if (input.equalsIgnoreCase("21")) {
return new StagesPrompt(questFactory);
} else {
return new CreateStagePrompt(stageNum, questFactory, citizens);
@ -3441,4 +3468,196 @@ public class CreateStagePrompt extends FixedSetPrompt {
}
}
private class NPCKillListPrompt extends FixedSetPrompt {
public NPCKillListPrompt() {
super("1", "2", "3", "4", "5", "6");
}
@Override
public String getPromptText(ConversationContext context) {
String text = GOLD + "- Kill NPCs -\n";
if (context.getSessionData(pref + "npcIdsToKill") == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set NPC IDs (None set)\n";
text += GRAY + "2 - Set kill amounts (No NPC IDs 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 NPC IDs\n";
for (int i : getNPCIds(context)) {
text += GRAY + " - " + AQUA + citizens.getNPCRegistry().getById(i).getName() + " (" + i + ")\n";
}
if (context.getSessionData(pref + "npcAmountsToKill") == null) {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set kill amounts (None set)\n";
} else {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set kill amounts\n";
for (Integer i : getKillAmounts(context)) {
text += GRAY + " - " + AQUA + i + "\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 NPCIDsToKillPrompt();
} else if (input.equalsIgnoreCase("2")) {
if (context.getSessionData(pref + "npcIdsToKill") == null) {
context.getForWhom().sendRawMessage(RED + "You must set NPC ids first!");
return new NPCKillListPrompt();
} else {
return new NPCAmountsToKillPrompt();
}
} else if (input.equalsIgnoreCase("3")) {
context.getForWhom().sendRawMessage(YELLOW + "Kill NPCs objective cleared.");
context.setSessionData(pref + "npcIdsToKill", null);
context.setSessionData(pref + "npcAmountsToKill", null);
return new NPCKillListPrompt();
} else if (input.equalsIgnoreCase("4")) {
int one;
int two;
if (context.getSessionData(pref + "npcIdsToKill") != null) {
one = ((List<Integer>) context.getSessionData(pref + "npcIdsToKill")).size();
} else {
one = 0;
}
if (context.getSessionData(pref + "npcAmountsToKill") != null) {
two = ((List<Integer>) context.getSessionData(pref + "npcAmountsToKill")).size();
} else {
two = 0;
}
if (one == two) {
return new CreateStagePrompt(stageNum, questFactory, citizens);
} else {
context.getForWhom().sendRawMessage(RED + "The list sizes are not equal!");
return new NPCKillListPrompt();
}
}
return null;
}
private List<Integer> getNPCIds(ConversationContext context) {
return (List<Integer>) context.getSessionData(pref + "npcIdsToKill");
}
private List<Integer> getKillAmounts(ConversationContext context) {
return (List<Integer>) context.getSessionData(pref + "npcAmountsToKill");
}
}
private class NPCIDsToKillPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter NPC IDs, separating each one by a space, or enter \'cancel\' to return.";
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false) {
String[] args = input.split(" ");
LinkedList<Integer> npcs = new LinkedList<Integer>();
for (String s : args) {
try {
Integer i = Integer.parseInt(s);
if (citizens.getNPCRegistry().getById(i) != null) {
npcs.add(i);
} else {
context.getForWhom().sendRawMessage(PINK + "" + i + RED + " is not a valid NPC ID!");
return new NPCIDsToKillPrompt();
}
} catch (Exception e) {
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
return new NPCIDsToKillPrompt();
}
}
context.setSessionData(pref + "npcIdsToKill", npcs);
}
return new NPCKillListPrompt();
}
}
private class NPCAmountsToKillPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter kill amounts, separating each one by a space, or enter \'cancel\' to return.";
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false) {
String[] args = input.split(" ");
LinkedList<Integer> amounts = new LinkedList<Integer>();
for (String s : args) {
try {
Integer i = Integer.parseInt(s);
amounts.add(i);
} catch (Exception e) {
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
return new NPCAmountsToKillPrompt();
}
}
context.setSessionData(pref + "npcAmountsToKill", amounts);
}
return new NPCKillListPrompt();
}
}
}

View File

@ -165,6 +165,9 @@ public class StagesPrompt extends StringPrompt{
cc.setSessionData(newPref + "shearColors", cc.getSessionData(pref + "shearColors"));
cc.setSessionData(newPref + "shearAmounts", cc.getSessionData(pref + "shearAmounts"));
cc.setSessionData(newPref + "npcIdsToKill", cc.getSessionData(pref + "npcIdsToKill"));
cc.setSessionData(newPref + "npcAmountsToKill", cc.getSessionData(pref + "npcAmountsToKill"));
cc.setSessionData(newPref + "event", cc.getSessionData(pref + "event"));
@ -221,6 +224,9 @@ public class StagesPrompt extends StringPrompt{
cc.setSessionData(pref + "shearColors", null);
cc.setSessionData(pref + "shearAmounts", null);
cc.setSessionData(pref + "npcIdsToKill", null);
cc.setSessionData(pref + "npcAmountsToKill", null);
cc.setSessionData(pref + "event", null);

View File

@ -44,6 +44,9 @@ stage#tameAmounts
stage#shearColors
stage#shearAmounts
stage#npcIdsToKill
stage#npcAmountsToKill
stage#event
stage#delay