Update 1.6

Git has been updated
This commit is contained in:
Alex C 2013-04-08 14:24:44 -07:00
parent 5e498424d7
commit 41252807dd
20 changed files with 17858 additions and 9398 deletions

View File

@ -1,34 +1,35 @@
# Quests config
#
#
# allow-command-questing: true/false
# Should we allow players to take Quests via commands?
#
# allow-command-quests-with-npcs: true/false
# Should we allow players to take Quests via commands, that have NPCs as quest starters?
#
# show-requirements: true/false
# Should players be told the exact requirements of a Quest when they look at its info (via command)?
#
# allow-quitting: true/false
# Should players be allowed to quit a Quest after they've taken it?
#
# debug-mode: true/false
# Should debugging information be printed out to console?
#
# kill-time: number
# How long (in seconds) should a player have to wait before they can kill the same player for a Quest?
allow-command-questing: true
allow-command-quests-with-npcs: false
show-requirements: true
allow-quitting: true
debug-mode: false
kill-delay: 600
quester-blacklist:
- "SomeGuy12345"
- "somePrefix*"
- "*someSuffix"
- "*someRegex*"
# Quests config
#
#
# allow-command-questing: true/false
# Should we allow players to take Quests via commands?
#
# allow-command-quests-with-npcs: true/false
# Should we allow players to take Quests via commands, that have NPCs as quest starters?
#
# show-requirements: true/false
# Should players be told the exact requirements of a Quest when they look at its info (via command)?
#
# allow-quitting: true/false
# Should players be allowed to quit a Quest after they've taken it?
#
# debug-mode: true/false
# Should debugging information be printed out to console?
#
# kill-time: number
# How long (in seconds) should a player have to wait before they can kill the same player for a Quest?
allow-command-questing: true
allow-command-quests-with-npcs: false
show-requirements: true
allow-quitting: true
debug-mode: false
kill-delay: 600
snoop: true
quester-blacklist:
- "SomeGuy12345"
- "somePrefix*"
- "*someSuffix"
- "*someRegex*"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,107 +1,130 @@
package me.blackvein.quests;
import net.citizensnpcs.api.event.NPCDespawnEvent;
import net.citizensnpcs.api.event.NPCRightClickEvent;
import org.bukkit.ChatColor;
import org.bukkit.conversations.Conversable;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
public class NpcListener implements Listener {
Quests plugin;
public NpcListener(Quests newPlugin) {
plugin = newPlugin;
}
@EventHandler(priority = EventPriority.LOWEST)
public void onNPCRightClick(NPCRightClickEvent evt) {
if (plugin.questNPCs.contains(evt.getNPC())) {
final Player player = evt.getClicker();
if (plugin.checkQuester(player.getName()) == false) {
final Quester quester = plugin.getQuester(player.getName());
if (quester.hasObjective("talkToNPC")) {
quester.interactWithNPC(evt.getNPC());
} else {
for (final Quest q : plugin.quests) {
if (q.npcStart != null && player.hasPermission("quests.quest")) {
if (q.npcStart.equals(evt.getNPC()) && quester.completedQuests.contains(q.name) == false) {
if (quester.currentQuest == null) {
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";
player.sendMessage(s);
plugin.conversationFactory.buildConversation((Conversable) player).begin();
} else if (quester.currentQuest.equals(q) == false) {
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
}
break;
} else if (q.npcStart.equals(evt.getNPC()) && quester.completedQuests.contains(q.name) == true) {
if (quester.currentQuest == null) {
if (quester.getDifference(q) > 0) {
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 {
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";
player.sendMessage(s);
plugin.conversationFactory.buildConversation((Conversable) player).begin();
}
} else if (quester.currentQuest.equals(q) == false) {
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
}
break;
}
}
}
}
}
}
}
@EventHandler
public void onNPCDespawn(NPCDespawnEvent evt) {
}
}
package me.blackvein.quests;
import net.citizensnpcs.api.event.NPCDespawnEvent;
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.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
public class NpcListener implements Listener {
Quests plugin;
public NpcListener(Quests newPlugin) {
plugin = newPlugin;
}
@EventHandler(priority = EventPriority.LOWEST)
public void onNPCRightClick(NPCRightClickEvent evt) {
final Player player = evt.getClicker();
final Quester quester = plugin.getQuester(player.getName());
boolean delivery = false;
if(quester.hasObjective("deliverItem") && player.getItemInHand() != null){
ItemStack hand = player.getItemInHand();
if(quester.itemsDelivered.containsKey(hand.getType())){
NPC clicked = evt.getNPC();
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) {
if (quester.hasObjective("talkToNPC")) {
quester.interactWithNPC(evt.getNPC());
} else {
for (Quest q : plugin.quests) {
if (q.npcStart != null && player.hasPermission("quests.quest")) {
if (q.npcStart.equals(evt.getNPC()) && quester.completedQuests.contains(q.name) == false) {
if (quester.currentQuest == null) {
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";
player.sendMessage(s);
plugin.conversationFactory.buildConversation((Conversable) player).begin();
} else if (quester.currentQuest.equals(q) == false) {
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
}
break;
} else if (q.npcStart.equals(evt.getNPC()) && quester.completedQuests.contains(q.name) == true) {
if (quester.currentQuest == null) {
if (quester.getDifference(q) > 0) {
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{
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";
player.sendMessage(s);
plugin.conversationFactory.buildConversation((Conversable) player).begin();
}
} else if (quester.currentQuest.equals(q) == false) {
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
}
break;
}
}
}
}
}
}
}
@EventHandler
public void onNPCDespawn(NPCDespawnEvent evt) {
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,454 +1,385 @@
package me.blackvein.quests;
import com.herocraftonline.heroes.characters.classes.HeroClass.ExperienceType;
import java.util.EnumMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
public class Quest {
String name;
String description;
String finished;
int redoDelay = -1;
LinkedList<Stage> stages = new LinkedList<Stage>();
NPC npcStart;
Location blockStart;
Quests plugin;
Map<Material, Integer> questItems = new EnumMap<Material, Integer>(Material.class);
//Requirements
int moneyReq = 0;
int questPointsReq = 0;
List<Integer> itemIds = new LinkedList<Integer>();
List<Integer> itemAmounts = new LinkedList<Integer>();
List<Boolean> removeItems = new LinkedList<Boolean>();
List<String> neededQuests = new LinkedList<String>();
List<String> permissionReqs = new LinkedList<String>();
String failRequirements;
//
//Rewards
int moneyReward = 0;
int questPoints = 0;
int exp = 0;
List<String> commands = new LinkedList<String>();
List<String> permissions = new LinkedList<String>();
LinkedList<ItemStack> itemRewards = new LinkedList<ItemStack>();
LinkedList<Integer> itemRewardAmounts = new LinkedList<Integer>();
//Heroes
int heroesExp = 0;
String heroesClass = null;
String heroesSecClass = null;
//
//mcMMO
List<String> mcmmoSkills = new LinkedList<String>();
List<Integer> mcmmoAmounts = new LinkedList<Integer>();
//
//
public void nextStage(Quester q){
if(q.currentStage.delay < 0){
Player player = plugin.getServer().getPlayerExact(q.name);
if(stages.indexOf(q.currentStage) == (stages.size() - 1)){
if(q.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
if(q.currentStage.event != null)
q.currentStage.event.happen(player);
completeQuest(q);
}else {
q.reset();
player.sendMessage(plugin.parseString(q.currentStage.finished, q.currentQuest));
if(q.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
if(q.currentStage.event != null)
q.currentStage.event.happen(player);
q.currentStage = stages.get(stages.indexOf(q.currentStage) + 1);
q.addEmpties();
for (Entry e : q.currentStage.itemsToCollect.entrySet()) {
if ((Boolean) e.getValue() == true) {
Map<Material, Integer> tempMap = (Map<Material, Integer>) e.getKey();
for (Entry e2 : tempMap.entrySet()) {
questItems.put((Material) e2.getKey(), (Integer) e2.getValue());
}
}
}
for (Entry e : q.currentStage.itemsToCraft.entrySet()) {
if ((Boolean) e.getValue() == true) {
Map<Material, Integer> tempMap = (Map<Material, Integer>) e.getKey();
for (Entry e2 : tempMap.entrySet()) {
questItems.put((Material) e2.getKey(), (Integer) e2.getValue());
}
}
}
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
for(String s : q.getObjectives()){
player.sendMessage(s);
}
}
q.delayStartTime = 0;
q.delayTimeLeft = -1;
}else{
q.startStageTimer();
}
}
public String getName(){
return name;
}
public boolean testRequirements(Player player){
Quester quester = plugin.getQuester(player.getName());
if(moneyReq != 0 && Quests.economy.getBalance(player.getName()) < moneyReq)
return false;
PlayerInventory inventory = player.getInventory();
int num = 0;
for(int i : itemIds){
for(ItemStack stack : inventory.getContents()){
if(stack != null){
if(i == stack.getTypeId())
num += stack.getAmount();
}
}
if(num < itemAmounts.get(itemIds.indexOf(i)))
return false;
num = 0;
}
for(String s : permissionReqs){
if(player.hasPermission(s) == false)
return false;
}
if(quester.questPoints < questPointsReq)
return false;
if(quester.completedQuests.containsAll(neededQuests) == false)
return false;
return true;
}
public void completeQuest(Quester q){
Player player = plugin.getServer().getPlayerExact(q.name);
q.reset();
q.completedQuests.add(name);
String none = ChatColor.GRAY + "- (None)";
player.sendMessage(plugin.parseString(finished, q.currentQuest));
if(moneyReward > 0 && Quests.economy != null){
Quests.economy.depositPlayer(q.name, moneyReward);
none = null;
}
if(redoDelay > -1)
q.completedTimes.put(this.name, System.currentTimeMillis());
for(ItemStack i : itemRewards){
Quests.addItem(player, i);
none = null;
}
for(Entry entry : questItems.entrySet()){
Material material = (Material) entry.getKey();
int amount = (Integer) entry.getValue();
for(ItemStack stack : player.getInventory().getContents()){
if(stack != null){
if(stack.getType().equals(material)){
if(stack.getAmount() > amount){
stack.setAmount(stack.getAmount() - amount);
break;
}else{
amount -= stack.getAmount();
stack.setAmount(0);
if(amount == 0)
break;
}
}
}
}
}
for(String s : commands){
s = s.replaceAll("<player>", player.getName());
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), s);
none = null;
}
for(String s : permissions){
Quests.permission.playerAdd(player, s);
none = null;
}
for(String s : mcmmoSkills){
Quests.mcmmo.getPlayerProfile(player.getName()).skillUp(Quests.getMcMMOSkill(s), mcmmoAmounts.get(mcmmoSkills.indexOf(s)));
none = null;
}
if(exp > 0){
player.giveExp(exp);
none = null;
}
if(heroesExp > 0){
plugin.heroes.getCharacterManager().getHero(player).gainExp(heroesExp, ExperienceType.QUESTING, player.getLocation());
none = null;
}
if(heroesClass != null){
plugin.heroes.getCharacterManager().getHero(player).changeHeroClass(plugin.heroes.getClassManager().getClass(heroesClass), false);
none = null;
}
if(heroesSecClass != null){
plugin.heroes.getCharacterManager().getHero(player).changeHeroClass(plugin.heroes.getClassManager().getClass(heroesSecClass), true);
none = null;
}
player.sendMessage(ChatColor.GOLD + "**QUEST COMPLETE: " + ChatColor.YELLOW + q.currentQuest.name + ChatColor.GOLD + "**");
player.sendMessage(ChatColor.GREEN + "Rewards:");
if(questPoints > 0){
player.sendMessage("- " + ChatColor.DARK_GREEN + questPoints + " Quest Points");
q.questPoints += questPoints;
none = null;
}
for(ItemStack i : itemRewards){
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + itemRewardAmounts.get(itemRewards.indexOf(i)));
none = null;
}
if(moneyReward > 1){
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(true));
none = null;
}else if(moneyReward == 1){
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(false));
none = null;
}
if(exp > 0){
player.sendMessage("- " + ChatColor.DARK_GREEN + exp + ChatColor.DARK_PURPLE + " Experience");
none = null;
}
if(heroesExp > 0){
player.sendMessage("- " + ChatColor.DARK_GREEN + heroesExp + ChatColor.DARK_PURPLE + " Heroes Exp");
none = null;
}
if(heroesClass != null){
player.sendMessage("- " + ChatColor.DARK_PURPLE + heroesClass + ChatColor.AQUA + " Heroes Class");
none = null;
}
if(heroesSecClass != null){
player.sendMessage("- " + ChatColor.DARK_PURPLE + heroesSecClass + ChatColor.AQUA + " Heroes Secondary Class");
none = null;
}
if(none != null){
player.sendMessage(none);
}
q.currentQuest = null;
q.currentStage = null;
q.saveData();
player.updateInventory();
}
@Override
public boolean equals(Object o){
if(o instanceof Quest){
Quest other = (Quest) o;
if(other.blockStart != null && blockStart != null){
if(other.blockStart.equals(blockStart) == false)
return false;
}else if(other.blockStart != null && blockStart == null){
return false;
}else if(other.blockStart == null && blockStart != null)
return false;
for(String s : other.commands){
if(commands.get(other.commands.indexOf(s)).equals(s) == false)
return false;
}
if(other.description.equals(description) == false)
return false;
if(other.exp != exp)
return false;
if(other.failRequirements != null && failRequirements != null){
if(other.failRequirements.equals(failRequirements) == false)
return false;
}else if(other.failRequirements != null && failRequirements == null){
return false;
}else if(other.failRequirements == null && failRequirements != null)
return false;
if(other.finished.equals(finished) == false)
return false;
if(other.heroesClass != null && heroesClass != null){
if(other.heroesClass.equals(heroesClass) == false)
return false;
}else if(other.heroesClass != null && heroesClass == null){
return false;
}else if(other.heroesClass == null && heroesClass != null)
return false;
if(other.heroesExp != heroesExp)
return false;
if(other.heroesSecClass != null && heroesSecClass != null){
if(other.heroesSecClass.equals(heroesSecClass) == false)
return false;
}else if(other.heroesSecClass != null && heroesSecClass == null){
return false;
}else if(other.heroesSecClass == null && heroesSecClass != null)
return false;
if(other.itemAmounts.equals(itemAmounts) == false)
return false;
if(other.itemIds.equals(itemIds) == false)
return false;
if(other.itemRewards.equals(itemRewards) == false)
return false;
if(other.mcmmoAmounts.equals(mcmmoAmounts) == false)
return false;
if(other.mcmmoSkills.equals(mcmmoSkills) == false)
return false;
if(other.moneyReq != moneyReq)
return false;
if(other.moneyReward != moneyReward)
return false;
if(other.name.equals(name) == false)
return false;
if(other.neededQuests.equals(neededQuests) == false)
return false;
if(other.npcStart != null && npcStart != null){
if(other.npcStart.equals(npcStart) == false)
return false;
}else if(other.npcStart != null && npcStart == null){
return false;
}else if(other.npcStart == null && npcStart != null)
return false;
if(other.permissionReqs.equals(permissionReqs) == false)
return false;
if(other.permissions.equals(permissions) == false)
return false;
if(other.questItems.equals(questItems) == false)
return false;
if(other.questPoints != questPoints)
return false;
if(other.questPointsReq != questPointsReq)
if(other.redoDelay != redoDelay)
return false;
if(other.stages.equals(stages) == false)
return false;
}
return true;
}
}
package me.blackvein.quests;
import java.util.EnumMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
public class Quest {
String name;
String description;
String finished;
int redoDelay = -1;
LinkedList<Stage> stages = new LinkedList<Stage>();
NPC npcStart;
Location blockStart;
Quests plugin;
Map<Material, Integer> questItems = new EnumMap<Material, Integer>(Material.class);
//Requirements
int moneyReq = 0;
int questPointsReq = 0;
List<Integer> itemIds = new LinkedList<Integer>();
List<Integer> itemAmounts = new LinkedList<Integer>();
List<Boolean> removeItems = new LinkedList<Boolean>();
List<String> neededQuests = new LinkedList<String>();
List<String> permissionReqs = new LinkedList<String>();
String failRequirements;
//
//Rewards
int moneyReward = 0;
int questPoints = 0;
int exp = 0;
List<String> commands = new LinkedList<String>();
List<String> permissions = new LinkedList<String>();
LinkedList<ItemStack> itemRewards = new LinkedList<ItemStack>();
LinkedList<Integer> itemRewardAmounts = new LinkedList<Integer>();
//mcMMO
List<String> mcmmoSkills = new LinkedList<String>();
List<Integer> mcmmoAmounts = new LinkedList<Integer>();
//
//
public void nextStage(Quester q){
if(q.currentStage.delay < 0){
Player player = plugin.getServer().getPlayerExact(q.name);
if(stages.indexOf(q.currentStage) == (stages.size() - 1)){
if(q.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
if(q.currentStage.event != null)
q.currentStage.event.happen(q);
completeQuest(q);
}else {
q.reset();
if(q.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
if(q.currentStage.event != null)
q.currentStage.event.happen(q);
q.currentStage = stages.get(stages.indexOf(q.currentStage) + 1);
q.addEmpties();
for (Entry e : q.currentStage.itemsToCraft.entrySet()) {
if ((Boolean) e.getValue() == true) {
Map<Material, Integer> tempMap = (Map<Material, Integer>) e.getKey();
for (Entry e2 : tempMap.entrySet()) {
questItems.put((Material) e2.getKey(), (Integer) e2.getValue());
}
}
}
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
for(String s : q.getObjectives()){
player.sendMessage(s);
}
}
q.delayStartTime = 0;
q.delayTimeLeft = -1;
}else{
q.startStageTimer();
}
}
public String getName(){
return name;
}
public boolean testRequirements(Player player){
Quester quester = plugin.getQuester(player.getName());
if(moneyReq != 0 && Quests.economy.getBalance(player.getName()) < moneyReq)
return false;
PlayerInventory inventory = player.getInventory();
int num = 0;
for(int i : itemIds){
for(ItemStack stack : inventory.getContents()){
if(stack != null){
if(i == stack.getTypeId())
num += stack.getAmount();
}
}
if(num < itemAmounts.get(itemIds.indexOf(i)))
return false;
num = 0;
}
for(String s : permissionReqs){
if(player.hasPermission(s) == false)
return false;
}
if(quester.questPoints < questPointsReq)
return false;
if(quester.completedQuests.containsAll(neededQuests) == false)
return false;
return true;
}
public void completeQuest(Quester q){
Player player = plugin.getServer().getPlayerExact(q.name);
q.reset();
q.completedQuests.add(name);
String none = ChatColor.GRAY + "- (None)";
player.sendMessage(Quests.parseString(finished, q.currentQuest));
if(moneyReward > 0 && Quests.economy != null){
Quests.economy.depositPlayer(q.name, moneyReward);
none = null;
}
if(redoDelay > -1)
q.completedTimes.put(this.name, System.currentTimeMillis());
for(ItemStack i : itemRewards){
Quests.addItem(player, i);
none = null;
}
for(Entry entry : questItems.entrySet()){
Material material = (Material) entry.getKey();
int amount = (Integer) entry.getValue();
for(ItemStack stack : player.getInventory().getContents()){
if(stack != null){
if(stack.getType().equals(material)){
if(stack.getAmount() > amount){
stack.setAmount(stack.getAmount() - amount);
break;
}else{
amount -= stack.getAmount();
stack.setAmount(0);
if(amount == 0)
break;
}
}
}
}
}
for(String s : commands){
s = s.replaceAll("<player>", player.getName());
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), s);
none = null;
}
for(String s : permissions){
Quests.permission.playerAdd(player, s);
none = null;
}
for(String s : mcmmoSkills){
Quests.mcmmo.getPlayerProfile(player.getName()).skillUp(Quests.getMcMMOSkill(s), mcmmoAmounts.get(mcmmoSkills.indexOf(s)));
none = null;
}
if(exp > 0){
player.giveExp(exp);
none = null;
}
player.sendMessage(ChatColor.GOLD + "**QUEST COMPLETE: " + ChatColor.YELLOW + q.currentQuest.name + ChatColor.GOLD + "**");
player.sendMessage(ChatColor.GREEN + "Rewards:");
if(questPoints > 0){
player.sendMessage("- " + ChatColor.DARK_GREEN + questPoints + " Quest Points");
q.questPoints += questPoints;
none = null;
}
for(ItemStack i : itemRewards){
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + itemRewardAmounts.get(itemRewards.indexOf(i)));
none = null;
}
if(moneyReward > 1){
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(true));
none = null;
}else if(moneyReward == 1){
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(false));
none = null;
}
if(exp > 0){
player.sendMessage("- " + ChatColor.DARK_GREEN + exp + ChatColor.DARK_PURPLE + " Experience");
none = null;
}
if(none != null){
player.sendMessage(none);
}
q.currentQuest = null;
q.currentStage = null;
q.saveData();
player.updateInventory();
}
@Override
public boolean equals(Object o){
if(o instanceof Quest){
Quest other = (Quest) o;
if(other.blockStart != null && blockStart != null){
if(other.blockStart.equals(blockStart) == false)
return false;
}else if(other.blockStart != null && blockStart == null){
return false;
}else if(other.blockStart == null && blockStart != null)
return false;
for(String s : other.commands){
if(commands.get(other.commands.indexOf(s)).equals(s) == false)
return false;
}
if(other.description.equals(description) == false)
return false;
if(other.exp != exp)
return false;
if(other.failRequirements != null && failRequirements != null){
if(other.failRequirements.equals(failRequirements) == false)
return false;
}else if(other.failRequirements != null && failRequirements == null){
return false;
}else if(other.failRequirements == null && failRequirements != null)
return false;
if(other.finished.equals(finished) == false)
return false;
if(other.itemAmounts.equals(itemAmounts) == false)
return false;
if(other.itemIds.equals(itemIds) == false)
return false;
if(other.itemRewards.equals(itemRewards) == false)
return false;
if(other.mcmmoAmounts.equals(mcmmoAmounts) == false)
return false;
if(other.mcmmoSkills.equals(mcmmoSkills) == false)
return false;
if(other.moneyReq != moneyReq)
return false;
if(other.moneyReward != moneyReward)
return false;
if(other.name.equals(name) == false)
return false;
if(other.neededQuests.equals(neededQuests) == false)
return false;
if(other.npcStart != null && npcStart != null){
if(other.npcStart.equals(npcStart) == false)
return false;
}else if(other.npcStart != null && npcStart == null){
return false;
}else if(other.npcStart == null && npcStart != null)
return false;
if(other.permissionReqs.equals(permissionReqs) == false)
return false;
if(other.permissions.equals(permissions) == false)
return false;
if(other.questItems.equals(questItems) == false)
return false;
if(other.questPoints != questPoints)
return false;
if(other.questPointsReq != questPointsReq)
if(other.redoDelay != redoDelay)
return false;
if(other.stages.equals(stages) == false)
return false;
}
return true;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,17 @@
package me.blackvein.quests;
import java.util.List;
import net.aufdemrand.denizen.scripts.ScriptEngine.QueueType;
import net.aufdemrand.denizen.scripts.ScriptHelper;
import net.aufdemrand.denizen.triggers.AbstractTrigger;
import org.bukkit.entity.Player;
public class QuestTaskTrigger extends AbstractTrigger {
public boolean parseQuestTaskTrigger(String theScriptName, Player thePlayer) {
ScriptHelper sE = plugin.getScriptEngine().helper;
if (theScriptName == null) return false;
List<String> theScript = sE.getScript(theScriptName + ".Script");
if (theScript.isEmpty()) return false;
sE.queueScriptEntries(thePlayer, sE.buildScriptEntries(thePlayer, theScript, theScriptName), QueueType.TASK);
return true;
}
package me.blackvein.quests;
import net.aufdemrand.denizen.scripts.ScriptRegistry;
import net.aufdemrand.denizen.scripts.containers.core.TaskScriptContainer;
import org.bukkit.entity.Player;
public class QuestTaskTrigger {
public boolean parseQuestTaskTrigger(String theScriptName, Player thePlayer) {
if (!ScriptRegistry.containsScript(theScriptName)) {
return false;
}
TaskScriptContainer task_script = ScriptRegistry.getScriptContainerAs(theScriptName, TaskScriptContainer.class);
task_script.runTaskScript(thePlayer, null, null);
return true;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,256 +1,286 @@
package me.blackvein.quests;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
public class Stage {
public String finished;
Map<Material, Integer> blocksToDamage = new EnumMap<Material, Integer>(Material.class);
Map<Material, Integer> blocksToBreak = new EnumMap<Material, Integer>(Material.class);
Map<Material, Integer> blocksToPlace = new EnumMap<Material, Integer>(Material.class);
Map<Map<Material, Integer>, Boolean> itemsToCollect = new HashMap<Map<Material, Integer>, Boolean>();
Map<Material, Integer> blocksToUse = new EnumMap<Material, Integer>(Material.class);
Map<Material, Integer> blocksToCut = new EnumMap<Material, Integer>(Material.class);
Integer fishToCatch;
Integer playersToKill;
Map<Map<Enchantment, Material>, Integer> itemsToEnchant = new HashMap<Map<Enchantment, Material>, Integer>();
LinkedList<EntityType> mobsToKill = new LinkedList<EntityType>();
LinkedList<Integer> mobNumToKill = new LinkedList<Integer>();
LinkedList<Location> locationsToKillWithin = new LinkedList<Location>();
LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>();
LinkedList<String> areaNames = new LinkedList<String>();
LinkedList<NPC> citizensToInteract = new LinkedList<NPC>(){
@Override
public boolean equals(Object o) {
if (o instanceof LinkedList) {
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
for (NPC n : this) {
NPC other = otherList.get(this.indexOf(n));
if (other.getId() != n.getId()) {
return false;
}
}
}
return true;
}
};
LinkedList<NPC> citizensToKill = new LinkedList<NPC>() {
@Override
public boolean equals(Object o) {
if (o instanceof LinkedList) {
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
for (NPC n : this) {
NPC other = otherList.get(this.indexOf(n));
if (other.getId() != n.getId()) {
return false;
}
}
}
return true;
}
};
LinkedList<Integer> citizenNumToKill = new LinkedList<Integer>();
LinkedList<Location> locationsToReach = new LinkedList<Location>();
LinkedList<Integer> radiiToReachWithin = new LinkedList<Integer>();
LinkedList<World> worldsToReachWithin = new LinkedList<World>();
LinkedList<String> locationNames = new LinkedList<String>();
Map<EntityType, Integer> mobsToTame = new EnumMap<EntityType, Integer>(EntityType.class);
Map<DyeColor, Integer> sheepToShear = new EnumMap<DyeColor, Integer>(DyeColor.class);
Map<EnumMap<Material, Integer>, Boolean> itemsToCraft = new HashMap<EnumMap<Material, Integer>, Boolean>();
String script;
Event event;
long delay = -1;
String delayMessage = null;
@Override
public boolean equals(Object o) {
if (o instanceof Stage) {
Stage other = (Stage) o;
if (other.finished != null && finished != null) {
if (other.finished.equals(finished) == false) {
return false;
}
} else if (other.finished != null && finished == null) {
return false;
} else if (other.finished == null && finished != null) {
return false;
}
if (other.blocksToDamage.equals(blocksToDamage) == false) {
return false;
}
if (other.blocksToBreak.equals(blocksToBreak) == false) {
return false;
}
if (other.blocksToPlace.equals(blocksToPlace) == false) {
return false;
}
if (other.itemsToCollect.equals(itemsToCollect) == false) {
return false;
}
if (other.blocksToUse.equals(blocksToUse) == false) {
return false;
}
if (other.blocksToCut.equals(blocksToCut) == false) {
return false;
}
if (other.fishToCatch != null && fishToCatch != null) {
if (other.fishToCatch.equals(fishToCatch) == false) {
return false;
}
} else if (other.fishToCatch != null && fishToCatch == null) {
return false;
} else if (other.fishToCatch == null && fishToCatch != null) {
return false;
}
if (other.playersToKill != null && playersToKill != null) {
if (other.playersToKill.equals(playersToKill) == false) {
return false;
}
} else if (other.playersToKill != null && playersToKill == null) {
return false;
} else if (other.playersToKill == null && playersToKill != null) {
return false;
}
if (other.itemsToEnchant.equals(itemsToEnchant) == false) {
return false;
}
if (other.mobsToKill.equals(mobsToKill) == false) {
return false;
}
if (other.mobNumToKill.equals(mobNumToKill) == false) {
return false;
}
if (other.locationsToKillWithin.equals(locationsToKillWithin) == false) {
return false;
}
if (other.radiiToKillWithin.equals(radiiToKillWithin) == false) {
return false;
}
if (other.areaNames.equals(areaNames) == false) {
return false;
}
if (other.citizensToInteract.equals(citizensToInteract) == false) {
return false;
}
if (other.citizensToKill.equals(citizensToKill) == false) {
return false;
}
if (other.citizenNumToKill.equals(citizenNumToKill) == false) {
return false;
}
if (other.locationsToReach.equals(locationsToReach) == false) {
return false;
}
if (other.radiiToReachWithin.equals(radiiToReachWithin) == false) {
return false;
}
if (other.worldsToReachWithin.equals(worldsToReachWithin) == false) {
return false;
}
if (other.locationNames.equals(locationNames) == false) {
return false;
}
if (other.mobsToTame.equals(mobsToTame) == false) {
return false;
}
if (other.sheepToShear.equals(sheepToShear) == false) {
return false;
}
if (other.itemsToCraft.equals(itemsToCraft) == false) {
return false;
}
if (other.script != null && script != null) {
if (other.script.equals(script) == false) {
return false;
}
} else if (other.script != null && script == null) {
return false;
} else if (other.script == null && script != null) {
return false;
}
if (other.event != null && event != null) {
if (other.event.equals(event) == false) {
return false;
}
} else if (other.event != null && event == null) {
return false;
} else if (other.event == null && event != null) {
return false;
}
if(other.delay != delay)
return false;
if (other.delayMessage != null && delayMessage != null) {
if (other.delayMessage.equals(delayMessage) == false) {
return false;
}
} else if (other.delayMessage != null && delayMessage == null) {
return false;
} else if (other.delayMessage == null && delayMessage != null) {
return false;
}
}
return true;
}
}
package me.blackvein.quests;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
public class Stage {
Map<Material, Integer> blocksToDamage = new EnumMap<Material, Integer>(Material.class);
Map<Material, Integer> blocksToBreak = new EnumMap<Material, Integer>(Material.class);
Map<Material, Integer> blocksToPlace = new EnumMap<Material, Integer>(Material.class);
Map<Material, Integer> blocksToUse = new EnumMap<Material, Integer>(Material.class);
Map<Material, Integer> blocksToCut = new EnumMap<Material, Integer>(Material.class);
Integer fishToCatch;
Integer playersToKill;
Map<Map<Enchantment, Material>, Integer> itemsToEnchant = new HashMap<Map<Enchantment, Material>, Integer>();
LinkedList<EntityType> mobsToKill = new LinkedList<EntityType>();
LinkedList<Integer> mobNumToKill = new LinkedList<Integer>();
LinkedList<Location> locationsToKillWithin = new LinkedList<Location>();
LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>();
LinkedList<String> areaNames = new LinkedList<String>();
LinkedList<Material> itemsToDeliver = new LinkedList<Material>();
LinkedList<Integer> itemAmountsToDeliver = new LinkedList<Integer>();
LinkedList<NPC> itemDeliveryTargets = new LinkedList<NPC>(){
@Override
public boolean equals(Object o) {
if (o instanceof LinkedList) {
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
for (NPC n : this) {
NPC other = otherList.get(this.indexOf(n));
if (other.getId() != n.getId()) {
return false;
}
}
}
return true;
}
};
ArrayList<String> deliverMessages = new ArrayList<String>();
LinkedList<NPC> citizensToInteract = new LinkedList<NPC>(){
@Override
public boolean equals(Object o) {
if (o instanceof LinkedList) {
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
for (NPC n : this) {
NPC other = otherList.get(this.indexOf(n));
if (other.getId() != n.getId()) {
return false;
}
}
}
return true;
}
};
LinkedList<NPC> citizensToKill = new LinkedList<NPC>() {
@Override
public boolean equals(Object o) {
if (o instanceof LinkedList) {
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
for (NPC n : this) {
NPC other = otherList.get(this.indexOf(n));
if (other.getId() != n.getId()) {
return false;
}
}
}
return true;
}
};
LinkedList<Integer> citizenNumToKill = new LinkedList<Integer>();
LinkedList<Location> locationsToReach = new LinkedList<Location>();
LinkedList<Integer> radiiToReachWithin = new LinkedList<Integer>();
LinkedList<World> worldsToReachWithin = new LinkedList<World>();
LinkedList<String> locationNames = new LinkedList<String>();
Map<EntityType, Integer> mobsToTame = new EnumMap<EntityType, Integer>(EntityType.class);
Map<DyeColor, Integer> sheepToShear = new EnumMap<DyeColor, Integer>(DyeColor.class);
Map<EnumMap<Material, Integer>, Boolean> itemsToCraft = new HashMap<EnumMap<Material, Integer>, Boolean>();
String script;
Event event;
long delay = -1;
String delayMessage = null;
@Override
public boolean equals(Object o) {
if (o instanceof Stage) {
Stage other = (Stage) o;
if (other.blocksToDamage.equals(blocksToDamage) == false) {
return false;
}
if (other.blocksToBreak.equals(blocksToBreak) == false) {
return false;
}
if (other.blocksToPlace.equals(blocksToPlace) == false) {
return false;
}
if (other.blocksToUse.equals(blocksToUse) == false) {
return false;
}
if (other.blocksToCut.equals(blocksToCut) == false) {
return false;
}
if (other.fishToCatch != null && fishToCatch != null) {
if (other.fishToCatch.equals(fishToCatch) == false) {
return false;
}
} else if (other.fishToCatch != null && fishToCatch == null) {
return false;
} else if (other.fishToCatch == null && fishToCatch != null) {
return false;
}
if (other.playersToKill != null && playersToKill != null) {
if (other.playersToKill.equals(playersToKill) == false) {
return false;
}
} else if (other.playersToKill != null && playersToKill == null) {
return false;
} else if (other.playersToKill == null && playersToKill != null) {
return false;
}
if (other.itemsToEnchant.equals(itemsToEnchant) == false) {
return false;
}
if (other.mobsToKill.equals(mobsToKill) == false) {
return false;
}
if (other.mobNumToKill.equals(mobNumToKill) == false) {
return false;
}
if (other.locationsToKillWithin.equals(locationsToKillWithin) == false) {
return false;
}
if (other.radiiToKillWithin.equals(radiiToKillWithin) == false) {
return false;
}
if (other.areaNames.equals(areaNames) == false) {
return false;
}
if (other.itemsToDeliver.equals(itemsToDeliver) == false){
return false;
}
if (other.itemAmountsToDeliver.equals(itemAmountsToDeliver) == false){
return false;
}
if (other.itemDeliveryTargets.equals(itemDeliveryTargets) == false){
return false;
}
if (other.deliverMessages.equals(deliverMessages) == false){
return false;
}
if (other.citizensToInteract.equals(citizensToInteract) == false) {
return false;
}
if (other.citizensToKill.equals(citizensToKill) == false) {
return false;
}
if (other.citizenNumToKill.equals(citizenNumToKill) == false) {
return false;
}
if (other.locationsToReach.equals(locationsToReach) == false) {
return false;
}
if (other.radiiToReachWithin.equals(radiiToReachWithin) == false) {
return false;
}
if (other.worldsToReachWithin.equals(worldsToReachWithin) == false) {
return false;
}
if (other.locationNames.equals(locationNames) == false) {
return false;
}
if (other.mobsToTame.equals(mobsToTame) == false) {
return false;
}
if (other.sheepToShear.equals(sheepToShear) == false) {
return false;
}
if (other.itemsToCraft.equals(itemsToCraft) == false) {
return false;
}
if (other.script != null && script != null) {
if (other.script.equals(script) == false) {
return false;
}
} else if (other.script != null && script == null) {
return false;
} else if (other.script == null && script != null) {
return false;
}
if (other.event != null && event != null) {
if (other.event.equals(event) == false) {
return false;
}
} else if (other.event != null && event == null) {
return false;
} else if (other.event == null && event != null) {
return false;
}
if(other.delay != delay)
return false;
if (other.delayMessage != null && delayMessage != null) {
if (other.delayMessage.equals(delayMessage) == false) {
return false;
}
} else if (other.delayMessage != null && delayMessage == null) {
return false;
} else if (other.delayMessage == null && delayMessage != null) {
return false;
}
}
return true;
}
}

View File

@ -1,66 +1,65 @@
package me.blackvein.quests;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class StageTimer implements Runnable{
Quester quester;
Quests plugin;
public StageTimer(Quests quests, Quester q){
quester = q;
plugin = quests;
}
@Override
public void run(){
if(quester.delayOver){
Player player = plugin.getServer().getPlayerExact(quester.name);
if(quester.currentQuest != null){
if(quester.currentQuest.stages.indexOf(quester.currentStage) == (quester.currentQuest.stages.size() - 1)){
if(quester.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
if(quester.currentStage.event != null)
quester.currentStage.event.happen(player);
quester.currentQuest.completeQuest(quester);
}else {
quester.reset();
player.sendMessage(plugin.parseString(quester.currentStage.finished, quester.currentQuest));
if(quester.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
if(quester.currentStage.event != null)
quester.currentStage.event.happen(player);
quester.currentStage = quester.currentQuest.stages.get(quester.currentQuest.stages.indexOf(quester.currentStage) + 1);
quester.addEmpties();
quester.delayStartTime = 0;
quester.delayTimeLeft = -1;
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
for(String s : quester.getObjectives()){
player.sendMessage(s);
}
}
}
quester.delayOver = true;
}
}
}
package me.blackvein.quests;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class StageTimer implements Runnable{
Quester quester;
Quests plugin;
public StageTimer(Quests quests, Quester q){
quester = q;
plugin = quests;
}
@Override
public void run(){
if(quester.delayOver){
Player player = plugin.getServer().getPlayerExact(quester.name);
if(quester.currentQuest != null){
if(quester.currentQuest.stages.indexOf(quester.currentStage) == (quester.currentQuest.stages.size() - 1)){
if(quester.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
if(quester.currentStage.event != null)
quester.currentStage.event.happen(quester);
quester.currentQuest.completeQuest(quester);
}else {
quester.reset();
if(quester.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
if(quester.currentStage.event != null)
quester.currentStage.event.happen(quester);
quester.currentStage = quester.currentQuest.stages.get(quester.currentQuest.stages.indexOf(quester.currentStage) + 1);
quester.addEmpties();
quester.delayStartTime = 0;
quester.delayTimeLeft = -1;
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
for(String s : quester.getObjectives()){
player.sendMessage(s);
}
}
}
quester.delayOver = true;
}
}
}

View File

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,610 @@
package me.blackvein.quests.prompts;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import me.blackvein.quests.Quest;
import me.blackvein.quests.QuestFactory;
import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.conversations.*;
public class RequirementsPrompt extends FixedSetPrompt{
Quests quests;
static final ChatColor BOLD = ChatColor.BOLD;
static final ChatColor AQUA = ChatColor.AQUA;
static final ChatColor DARKAQUA = ChatColor.DARK_AQUA;
static final ChatColor BLUE = ChatColor.BLUE;
static final ChatColor GOLD = ChatColor.GOLD;
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;
static final ChatColor GRAY = ChatColor.GRAY;
static final ChatColor RESET = ChatColor.RESET;
final QuestFactory factory;
public RequirementsPrompt(Quests plugin, QuestFactory qf){
super("1", "2", "3", "4", "5", "6", "7");
quests = plugin;
factory = qf;
}
@Override
public String getPromptText(ConversationContext context){
String text;
text = DARKAQUA + "- " + AQUA + context.getSessionData("questName") + AQUA + " | Requirements -\n";
if(context.getSessionData("moneyReq") == null)
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money requirement " + GRAY + "(None set)\n";
else{
int moneyReq = (Integer) context.getSessionData("moneyReq");
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money requirement (" + context.getSessionData("moneyReq") + " " + (moneyReq > 1 ? Quests.getCurrency(true) : Quests.getCurrency(false)) + ")\n";
}
if(context.getSessionData("questPointsReq") == null)
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set Quest Points requirement " + GRAY + "(None set)\n";
else{
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set Quest Points requirement " + GRAY + "(" + AQUA + context.getSessionData("questPointsReq") + " Quest Points" + GRAY + ")\n";
}
if(context.getSessionData("itemIdReqs") == null)
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set item requirements " + GRAY + "(None set)\n";
else{
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set item requirements\n";
List<Integer> ids = (List<Integer>) context.getSessionData("itemIdReqs");
List<Integer> amounts = (List<Integer>) context.getSessionData("itemAmountReqs");
List<Boolean> removes = (List<Boolean>) context.getSessionData("removeItemReqs");
for(int i : ids){
text += GRAY + " - " + AQUA + Quester.prettyItemString(i) + YELLOW + " x " + AQUA + amounts.get(ids.indexOf(i));
if(removes.get(ids.indexOf(i)) == false)
text += GRAY + "(" + DARKRED + "Remove" + GRAY + ")\n";
else
text += GRAY + "(" + DARKGREEN + "Keep" + GRAY + ")\n";
}
}
if(context.getSessionData("permissionReqs") == null)
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set permission requirements " + GRAY + "(None set)\n";
else{
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set permission requirements\n";
List<String> perms = (List<String>) context.getSessionData("permissionReqs");
for(String s : perms){
text += GRAY + " - " + AQUA + s + "\n";
}
}
if(context.getSessionData("questReqs") == null)
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set Quest requirements " + GRAY + "(None set)\n";
else{
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set Quest requirements\n";
List<String> qs = (List<String>) context.getSessionData("questReqs");
for(String s : qs){
text += GRAY + " - " + AQUA + s + "\n";
}
}
if(context.getSessionData("moneyReq") == null && context.getSessionData("questPointsReq") == null && context.getSessionData("itemIdReqs") == null && context.getSessionData("permissionReqs") == null && context.getSessionData("questReqs") == null){
text += GRAY + "" + BOLD + "6 - " + RESET + GRAY + "Set fail requirements message (No requirements set)\n";
}else if(context.getSessionData("failMessage") == null){
text += RED + "" + BOLD + "6 - " + RESET + RED + "Set fail requirements message (Required)\n";
}else{
text += BLUE + "" + BOLD + "6 - " + RESET + YELLOW + "Set fail requirements message" + GRAY + "(" + AQUA + "\"" + context.getSessionData("failMessage") + "\"" + GRAY + ")\n";
}
text += GREEN + "" + BOLD + "7" + RESET + YELLOW + " - Done";
return text;
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, String input){
if(input.equalsIgnoreCase("1")){
return new MoneyPrompt();
}else if(input.equalsIgnoreCase("2")){
return new QuestPointsPrompt();
}else if(input.equalsIgnoreCase("3")){
return new ItemListPrompt();
}else if(input.equalsIgnoreCase("4")){
return new PermissionsPrompt();
}else if(input.equalsIgnoreCase("5")){
return new QuestListPrompt();
}else if(input.equalsIgnoreCase("6")){
return new FailMessagePrompt();
}else if(input.equalsIgnoreCase("7")){
if(context.getSessionData("moneyReq") != null || context.getSessionData("questPointsReq") != null || context.getSessionData("itemIdReqs") != null || context.getSessionData("permissionReqs") != null || context.getSessionData("questReqs") != null){
if(context.getSessionData("failMessage") == null){
context.getForWhom().sendRawMessage(RED + "You must set a fail requirements message!");
return new RequirementsPrompt(quests, factory);
}
}
return factory.returnToMenu();
}
return null;
}
private class MoneyPrompt extends NumericPrompt {
@Override
public String getPromptText(ConversationContext context){
return YELLOW + "Enter amount of " + PURPLE + ((Quests.economy.currencyNamePlural().isEmpty() ? "Money" : Quests.economy.currencyNamePlural())) + YELLOW + ", or 0 to clear the money requirement, or -1 to cancel";
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input){
if(input.intValue() < -1){
context.getForWhom().sendRawMessage(RED + "Amount must be greater than 0!");
return new MoneyPrompt();
}else if(input.intValue() == -1){
return new RequirementsPrompt(quests, factory);
}else if(input.intValue() == 0){
context.setSessionData("moneyReq", null);
return new RequirementsPrompt(quests, factory);
}
context.setSessionData("moneyReq", input.intValue());
return new RequirementsPrompt(quests, factory);
}
}
private class QuestPointsPrompt extends NumericPrompt {
@Override
public String getPromptText(ConversationContext context){
return YELLOW + "Enter amount of Quest Points, or 0 to clear the Quest Point requirement,\nor -1 to cancel";
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input){
if(input.intValue() < -1){
context.getForWhom().sendRawMessage(RED + "Amount must be greater than 0!");
return new QuestPointsPrompt();
}else if(input.intValue() == -1){
return new RequirementsPrompt(quests, factory);
}else if(input.intValue() == 0){
context.setSessionData("questPointsReq", null);
return new RequirementsPrompt(quests, factory);
}
context.setSessionData("questPointsReq", input.intValue());
return new RequirementsPrompt(quests, factory);
}
}
private class QuestListPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context){
String text = PINK + "- Quests -\n" + PURPLE;
boolean none = true;
for(Quest q : quests.getQuests()){
text += q.getName() + ", ";
none = false;
}
if(none)
text += "(None)\n";
else{
text = text.substring(0, (text.length() - 2));
text += "\n";
}
text += YELLOW + "Enter a list of Quest names separating each one by a " + RED + BOLD + "comma" + RESET + YELLOW + ", or enter \'clear\' to clear the list, or \'cancel\' to return.";
return text;
}
@Override
public Prompt acceptInput(ConversationContext context, String input){
if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
String[] args = input.split(",");
LinkedList<String> questNames = new LinkedList<String>();
for(String s : args){
if(quests.getQuest(s) == null){
context.getForWhom().sendRawMessage(PINK + s + " " + RED + "is not a Quest name!");
return new QuestListPrompt();
}
if(questNames.contains(s)){
context.getForWhom().sendRawMessage(RED + "List contains duplicates!");
return new QuestListPrompt();
}
questNames.add(s);
}
Collections.sort(questNames, new Comparator(){
@Override
public int compare(Object one, Object two){
String s = (String) one;
String s2 = (String) two;
return s.compareTo(s2);
}
});
context.setSessionData("questReqs", questNames);
}else if(input.equalsIgnoreCase("clear")){
context.setSessionData("questReqs", null);
}
return new RequirementsPrompt(quests, factory);
}
}
private class ItemListPrompt extends FixedSetPrompt {
public ItemListPrompt(){
super("1", "2", "3", "4", "5");
}
@Override
public String getPromptText(ConversationContext context){
String text = GOLD + "- Item Requirements -\n";
if(context.getSessionData("itemIdReqs") == null){
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set item IDs (None set)\n";
text += GRAY + "2 - Set item amounts (No IDs set)\n";
text += GRAY + "3 - Set remove items (No IDs set)\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Done";
}else{
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set item IDs\n";
for(Integer i : getItemIds(context)){
text += GRAY + " - " + AQUA + Quester.prettyItemString(i) + "\n";
}
if(context.getSessionData("itemAmountReqs") == null){
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set item amounts (None set)\n";
}else{
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set item amounts\n";
for(Integer i : getItemAmounts(context)){
text += GRAY + " - " + AQUA + i + "\n";
}
}
if(context.getSessionData("removeItemReqs") == null){
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set remove items (None set)\n";
}else{
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set remove items\n";
for(Boolean b : getRemoveItems(context)){
text += GRAY + " - " + AQUA + b.toString().toLowerCase() + "\n";
}
}
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Done";
}
return text;
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, String input){
if(input.equalsIgnoreCase("1")){
return new ItemIdsPrompt();
}else if(input.equalsIgnoreCase("2")){
if(context.getSessionData("itemIdReqs") == null){
context.getForWhom().sendRawMessage(RED + "You must set item IDs first!");
return new ItemListPrompt();
}else{
return new ItemAmountsPrompt();
}
}else if(input.equalsIgnoreCase("3")){
if(context.getSessionData("itemIdReqs") == null){
context.getForWhom().sendRawMessage(RED + "You must set item IDs first!");
return new ItemListPrompt();
}else{
return new RemoveItemsPrompt();
}
}else if(input.equalsIgnoreCase("4")){
context.getForWhom().sendRawMessage(YELLOW + "Item requirements cleared.");
context.setSessionData("itemIdReqs", null);
context.setSessionData("itemAmountReqs", null);
context.setSessionData("removeItemReqs", null);
return new ItemListPrompt();
}else if(input.equalsIgnoreCase("5")){
int one;
int two;
int three;
if(context.getSessionData("itemIdReqs") != null)
one = ((List<Integer>) context.getSessionData("itemIdReqs")).size();
else
one = 0;
if(context.getSessionData("itemAmountReqs") != null)
two = ((List<Integer>) context.getSessionData("itemAmountReqs")).size();
else
two = 0;
if(context.getSessionData("removeItemReqs") != null)
three = ((List<Integer>) context.getSessionData("removeItemReqs")).size();
else
three = 0;
if(one == two && two == three)
return new RequirementsPrompt(quests, factory);
else{
context.getForWhom().sendRawMessage(RED + "The " + GOLD + "item IDs list" + RED + ", " + GOLD + "item amounts list " + RED + "and " + GOLD + "remove items list " + RED + "are not the same size!");
return new ItemListPrompt();
}
}
return null;
}
private List<Integer> getItemIds(ConversationContext context){
return (List<Integer>) context.getSessionData("itemIdReqs");
}
private List<Integer> getItemAmounts(ConversationContext context){
return (List<Integer>) context.getSessionData("itemAmountReqs");
}
private List<Boolean> getRemoveItems(ConversationContext context){
return (List<Boolean>) context.getSessionData("removeItemReqs");
}
}
private class ItemIdsPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context){
return YELLOW + "Enter item 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> ids = new LinkedList<Integer>();
for(String s : args){
try{
if(Material.getMaterial(Integer.parseInt(s)) != null){
if(ids.contains(Integer.parseInt(s)) == false){
ids.add(Integer.parseInt(s));
}else{
context.getForWhom().sendRawMessage(RED + " List contains duplicates!");
return new ItemIdsPrompt();
}
}else{
context.getForWhom().sendRawMessage(PINK + s + RED + " is not a valid item ID!");
return new ItemIdsPrompt();
}
}catch (Exception e){
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
return new ItemIdsPrompt();
}
}
context.setSessionData("itemIdReqs", ids);
}
return new ItemListPrompt();
}
}
private class ItemAmountsPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context){
return YELLOW + "Enter item amounts (numbers), 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{
if(Integer.parseInt(s) > 0)
amounts.add(Integer.parseInt(s));
else{
context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!");
return new ItemAmountsPrompt();
}
}catch (Exception e){
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
return new ItemAmountsPrompt();
}
}
context.setSessionData("itemAmountReqs", amounts);
}
return new ItemListPrompt();
}
}
private class RemoveItemsPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context){
return YELLOW + "Enter a list of true/false values, 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<Boolean> booleans = new LinkedList<Boolean>();
for(String s : args){
if(s.equalsIgnoreCase("true") || s.equalsIgnoreCase("yes"))
booleans.add(true);
else if(s.equalsIgnoreCase("false") || s.equalsIgnoreCase("no"))
booleans.add(false);
else{
context.getForWhom().sendRawMessage(PINK + s + RED + " is not a true or false value!\n " + GOLD + "Example: true false true true");
return new RemoveItemsPrompt();
}
}
context.setSessionData("removeItemReqs", booleans);
}
return new ItemListPrompt();
}
}
private class PermissionsPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context){
return YELLOW + "Enter permission requirements 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){
if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
String[] args = input.split(" ");
LinkedList<String> permissions = new LinkedList<String>();
permissions.addAll(Arrays.asList(args));
context.setSessionData("permissionReqs", permissions);
}else if(input.equalsIgnoreCase("clear")){
context.setSessionData("permissionReqs", null);
}
return new RequirementsPrompt(quests, factory);
}
}
private class FailMessagePrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context){
return YELLOW + "Enter fail requirements message, or enter \'cancel\' to return.";
}
@Override
public Prompt acceptInput(ConversationContext context, String input){
if(input.equalsIgnoreCase("cancel") == false)
context.setSessionData("failMessage", input);
return new RequirementsPrompt(quests, factory);
}
}
}

View File

@ -0,0 +1,715 @@
package me.blackvein.quests.prompts;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import me.blackvein.quests.QuestFactory;
import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.conversations.*;
public class RewardsPrompt extends FixedSetPrompt{
Quests quests;
static final ChatColor BOLD = ChatColor.BOLD;
static final ChatColor ITALIC = ChatColor.ITALIC;
static final ChatColor AQUA = ChatColor.AQUA;
static final ChatColor DARKAQUA = ChatColor.DARK_AQUA;
static final ChatColor BLUE = ChatColor.BLUE;
static final ChatColor GOLD = ChatColor.GOLD;
static final ChatColor PINK = ChatColor.LIGHT_PURPLE;
static final ChatColor PURPLE = ChatColor.DARK_PURPLE;
static final ChatColor GREEN = ChatColor.GREEN;
static final ChatColor RED = ChatColor.RED;
static final ChatColor DARKRED = ChatColor.DARK_RED;
static final ChatColor YELLOW = ChatColor.YELLOW;
static final ChatColor GRAY = ChatColor.GRAY;
static final ChatColor RESET = ChatColor.RESET;
final QuestFactory factory;
public RewardsPrompt(Quests plugin, QuestFactory qf){
super("1", "2", "3", "4", "5", "6", "7", "8");
quests = plugin;
factory = qf;
}
@Override
public String getPromptText(ConversationContext context){
String text;
text = DARKAQUA + "- " + AQUA + context.getSessionData("questName") + AQUA + " | Rewards -\n";
if(context.getSessionData("moneyRew") == null)
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money reward (None set)\n";
else{
int moneyRew = (Integer) context.getSessionData("moneyRew");
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money reward (" + moneyRew + " " + (moneyRew > 1 ? Quests.getCurrency(true) : Quests.getCurrency(false)) + ")\n";
}
if(context.getSessionData("questPointsRew") == null)
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set Quest Points reward (None set)\n";
else{
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set Quest Points reward (" + context.getSessionData("questPointsRew") + " Quest Points)\n";
}
if(context.getSessionData("itemIdRews") == null)
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set item rewards (None set)\n";
else{
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set item rewards\n";
List<Integer> ids = (List<Integer>) context.getSessionData("itemIdRews");
List<Integer> amounts = (List<Integer>) context.getSessionData("itemAmountRews");
for(int i : ids){
text += GRAY + " - " + AQUA + Quester.prettyItemString(i) + YELLOW + " x " + DARKAQUA + amounts.get(ids.indexOf(i)) + "\n";
}
}
if(context.getSessionData("expRew") == null)
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set experience reward (None set)\n";
else{
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set experience reward (" + context.getSessionData("expRew") + " points)\n";
}
if(context.getSessionData("commandRews") == null)
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set command rewards (None set)\n";
else{
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set command rewards\n";
List<String> commands = (List<String>) context.getSessionData("commandRews");
for(String cmd : commands){
text += GRAY + " - " + AQUA + cmd + "\n";
}
}
if(context.getSessionData("permissionRews") == null)
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set permission rewards (None set)\n";
else{
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set permission rewards\n";
List<String> permissions = (List<String>) context.getSessionData("permissionRews");
for(String perm : permissions){
text += GRAY + " - " + AQUA + perm + "\n";
}
}
//mcMMO
if(Quests.mcmmo != null){
if(context.getSessionData("mcMMOSkillRews") == null)
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set mcMMO skill rewards (None set)\n";
else{
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set mcMMO skill rewards\n";
List<String> skills = (List<String>) context.getSessionData("mcMMOSkillRews");
List<Integer> amounts = (List<Integer>) context.getSessionData("mcMMOSkillAmounts");
for(String skill : skills){
text += GRAY + " - " + AQUA + skill + GRAY + " x " + DARKAQUA + amounts.get(skills.indexOf(skill)) + "\n";
}
}
}
//
if(Quests.mcmmo != null)
text += GREEN + "" + BOLD + "8" + RESET + YELLOW + " - Done";
else
text += GREEN + "" + BOLD + "7" + RESET + YELLOW + " - Done";
return text;
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, String input){
if(input.equalsIgnoreCase("1")){
return new MoneyPrompt();
}else if(input.equalsIgnoreCase("2")){
return new QuestPointsPrompt();
}else if(input.equalsIgnoreCase("3")){
return new ItemListPrompt();
}else if(input.equalsIgnoreCase("4")){
return new ExperiencePrompt();
}else if(input.equalsIgnoreCase("5")){
return new CommandsPrompt();
}else if(input.equalsIgnoreCase("6")){
return new PermissionsPrompt();
}else if(input.equalsIgnoreCase("7")){
if(Quests.mcmmo != null)
return new mcMMOListPrompt();
else
return factory.returnToMenu();
}else if(input.equalsIgnoreCase("8")){
if(Quests.mcmmo != null)
return factory.returnToMenu();
else
return new RewardsPrompt(quests, factory);
}
return null;
}
private class MoneyPrompt extends NumericPrompt {
@Override
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){
if(input.intValue() < -1){
context.getForWhom().sendRawMessage(RED + "Amount must be positive!");
return new MoneyPrompt();
}else if(input.intValue() == 0)
context.setSessionData("moneyRew", null);
else if(input.intValue() != -1)
context.setSessionData("moneyRew", input.intValue());
return new RewardsPrompt(quests, factory);
}
}
private class ExperiencePrompt extends NumericPrompt {
@Override
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){
if(input.intValue() < -1){
context.getForWhom().sendRawMessage(RED + "Amount must be positive!");
return new ExperiencePrompt();
}else if(input.intValue() == -1)
context.setSessionData("expRew", null);
else if(input.intValue() != 0)
context.setSessionData("expRew", input.intValue());
return new RewardsPrompt(quests, factory);
}
}
private class QuestPointsPrompt extends NumericPrompt {
@Override
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){
if(input.intValue() < -1){
context.getForWhom().sendRawMessage(RED + "Amount must be positive!");
return new QuestPointsPrompt();
}else if(input.intValue() == -1)
context.setSessionData("questPointsRew", null);
else if(input.intValue() != 0)
context.setSessionData("questPointsRew", input.intValue());
return new RewardsPrompt(quests, factory);
}
}
private class ItemListPrompt extends FixedSetPrompt {
public ItemListPrompt(){
super("1", "2", "3", "4");
}
@Override
public String getPromptText(ConversationContext context){
String text = GOLD + "- Item Rewards -\n";
if(context.getSessionData("itemIdRews") == null){
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set item IDs (None set)\n";
text += GRAY + "2 - Set item amounts (No 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 item IDs\n";
for(Integer i : getItemIds(context)){
text += GRAY + " - " + AQUA + Quester.prettyItemString(i) + "\n";
}
if(context.getSessionData("itemAmountRews") == null){
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set item amounts (None set)\n";
}else{
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set item amounts\n";
for(Integer i : getItemAmounts(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 ItemIdsPrompt();
}else if(input.equalsIgnoreCase("2")){
if(context.getSessionData("itemIdRews") == null){
context.getForWhom().sendRawMessage(RED + "You must set item IDs first!");
return new ItemListPrompt();
}else{
return new ItemAmountsPrompt();
}
}else if(input.equalsIgnoreCase("3")){
context.getForWhom().sendRawMessage(YELLOW + "Item rewards cleared.");
context.setSessionData("itemIdRews", null);
context.setSessionData("itemAmountRews", null);
return new ItemListPrompt();
}else if(input.equalsIgnoreCase("4")){
int one;
int two;
if(context.getSessionData("itemIdRews") != null)
one = ((List<Integer>) context.getSessionData("itemIdRews")).size();
else
one = 0;
if(context.getSessionData("itemAmountRews") != null)
two = ((List<Integer>) context.getSessionData("itemAmountRews")).size();
else
two = 0;
if(one == two)
return new RewardsPrompt(quests, factory);
else{
context.getForWhom().sendRawMessage(RED + "The " + GOLD + "item IDs list " + RED + "and " + GOLD + "item amounts list " + RED + "are not the same size!");
return new ItemListPrompt();
}
}
return null;
}
private List<Integer> getItemIds(ConversationContext context){
return (List<Integer>) context.getSessionData("itemIdRews");
}
private List<Integer> getItemAmounts(ConversationContext context){
return (List<Integer>) context.getSessionData("itemAmountRews");
}
}
private class ItemIdsPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context){
return YELLOW + "Enter item 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> ids = new LinkedList<Integer>();
for(String s : args){
try{
if(Material.getMaterial(Integer.parseInt(s)) != null){
if(ids.contains(Integer.parseInt(s)) == false){
ids.add(Integer.parseInt(s));
}else{
context.getForWhom().sendRawMessage(RED + "List contains duplicates!");
return new ItemIdsPrompt();
}
}else{
context.getForWhom().sendRawMessage(PINK + s + RED + " is not a valid item ID!");
return new ItemIdsPrompt();
}
}catch (Exception e){
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
return new ItemIdsPrompt();
}
}
context.setSessionData("itemIdRews", ids);
}
return new ItemListPrompt();
}
}
private class ItemAmountsPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context){
return YELLOW + "Enter item amounts (numbers) 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{
if(Integer.parseInt(s) > 0)
amounts.add(Integer.parseInt(s));
else{
context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!");
return new ItemAmountsPrompt();
}
}catch (Exception e){
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
return new ItemAmountsPrompt();
}
}
context.setSessionData("itemAmountRews", amounts);
}
return new ItemListPrompt();
}
}
private class CommandsPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context){
String note = GOLD + "\nNote: You may put <player> to specify the player who completed the Quest. e.g. " + AQUA + BOLD + ITALIC + "smite <player>" + 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){
if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
String[] args = input.split(",");
LinkedList<String> commands = new LinkedList<String>();
for(String s : args){
if(s.startsWith("/"))
s = s.substring(1);
commands.add(s);
}
context.setSessionData("commandRews", commands);
}else if(input.equalsIgnoreCase("clear")){
context.setSessionData("commandRews", null);
}
return new RewardsPrompt(quests, factory);
}
}
private class PermissionsPrompt extends StringPrompt {
@Override
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){
if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
String[] args = input.split(" ");
LinkedList<String> permissions = new LinkedList<String>();
permissions.addAll(Arrays.asList(args));
context.setSessionData("permissionRews", permissions);
}else if(input.equalsIgnoreCase("clear")){
context.setSessionData("permissionRews", null);
}
return new RewardsPrompt(quests, factory);
}
}
//mcMMO
private class mcMMOListPrompt extends FixedSetPrompt {
public mcMMOListPrompt(){
super("1", "2", "3", "4");
}
@Override
public String getPromptText(ConversationContext context){
String text = GOLD + "- mcMMO Rewards -\n";
if(context.getSessionData("mcMMOSkillRews") == 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{
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set skills\n";
for(String s : getSkills(context)){
text += GRAY + " - " + AQUA + s + "\n";
}
if(context.getSessionData("mcMMOAmountRews") == null){
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set skill amounts (None set)\n";
}else{
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set skill amounts\n";
for(Integer i : getSkillAmounts(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 ItemIdsPrompt();
}else if(input.equalsIgnoreCase("2")){
if(context.getSessionData("itemIdRews") == null){
context.getForWhom().sendRawMessage(RED + "You must set skills first!");
return new mcMMOListPrompt();
}else{
return new mcMMOAmountsPrompt();
}
}else if(input.equalsIgnoreCase("3")){
context.getForWhom().sendRawMessage(YELLOW + "mcMMO rewards cleared.");
context.setSessionData("mcMMOSkillRews", null);
context.setSessionData("mcMMOAmountRews", null);
return new mcMMOListPrompt();
}else if(input.equalsIgnoreCase("4")){
int one;
int two;
if(context.getSessionData("mcMMOSkillRews") != null)
one = ((List<Integer>) context.getSessionData("mcMMOSkillRews")).size();
else
one = 0;
if(context.getSessionData("mcMMOAmountRews") != null)
two = ((List<Integer>) context.getSessionData("mcMMOAmountRews")).size();
else
two = 0;
if(one == two)
return new RewardsPrompt(quests, factory);
else{
context.getForWhom().sendRawMessage(RED + "The " + GOLD + "skills list " + RED + "and " + GOLD + "skill amounts list " + RED + "are not the same size!");
return new mcMMOListPrompt();
}
}
return null;
}
private List<String> getSkills(ConversationContext context){
return (List<String>) context.getSessionData("mcMMORews");
}
private List<Integer> getSkillAmounts(ConversationContext context){
return (List<Integer>) context.getSessionData("mcMMOAmountRews");
}
}
private class mcMMOSkillsPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context){
String skillList =
GOLD + "-Skill List-\n" +
AQUA + "Acrobatics\n" +
AQUA + "All\n" +
AQUA + "Archery\n" +
AQUA + "Axes\n" +
AQUA + "Excavation\n" +
AQUA + "Fishing\n" +
AQUA + "Herbalism\n" +
AQUA + "Mining\n" +
AQUA + "Repair\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){
if(input.equalsIgnoreCase("cancel") == false){
String[] args = input.split(" ");
LinkedList<String> skills = new LinkedList<String>();
for(String s : args){
if(Quests.getMcMMOSkill(s) != null){
if(skills.contains(s) == false){
skills.add(Quester.getCapitalized(s));
}else{
context.getForWhom().sendRawMessage(RED + "List contains duplicates!");
return new mcMMOSkillsPrompt();
}
}else{
context.getForWhom().sendRawMessage(PINK + s + RED + " is not a valid mcMMO skill!");
return new mcMMOSkillsPrompt();
}
}
context.setSessionData("mcMMOSkillRews", skills);
}
return new mcMMOListPrompt();
}
}
private class mcMMOAmountsPrompt extends StringPrompt {
@Override
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){
if(input.equalsIgnoreCase("cancel") == false){
String[] args = input.split(" ");
LinkedList<Integer> amounts = new LinkedList<Integer>();
for(String s : args){
try{
if(Integer.parseInt(s) > 0)
amounts.add(Integer.parseInt(s));
else{
context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!");
return new mcMMOAmountsPrompt();
}
}catch (Exception e){
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
return new mcMMOAmountsPrompt();
}
}
context.setSessionData("mcMMOAmountRews", amounts);
}
return new mcMMOListPrompt();
}
}
}

View File

@ -0,0 +1,245 @@
package me.blackvein.quests.prompts;
import me.blackvein.quests.QuestFactory;
import org.bukkit.ChatColor;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
import org.bukkit.conversations.StringPrompt;
public class StagesPrompt extends StringPrompt{
private final QuestFactory questFactory;
static final ChatColor BOLD = ChatColor.BOLD;
static final ChatColor ITALIC = ChatColor.ITALIC;
static final ChatColor AQUA = ChatColor.AQUA;
static final ChatColor DARKAQUA = ChatColor.DARK_AQUA;
static final ChatColor BLUE = ChatColor.BLUE;
static final ChatColor GOLD = ChatColor.GOLD;
static final ChatColor PINK = ChatColor.LIGHT_PURPLE;
static final ChatColor PURPLE = ChatColor.DARK_PURPLE;
static final ChatColor GREEN = ChatColor.GREEN;
static final ChatColor RED = ChatColor.RED;
static final ChatColor DARKRED = ChatColor.DARK_RED;
static final ChatColor YELLOW = ChatColor.YELLOW;
static final ChatColor GRAY = ChatColor.GRAY;
static final ChatColor RESET = ChatColor.RESET;
public StagesPrompt(QuestFactory qf){
questFactory = qf;
}
@Override
public String getPromptText(ConversationContext cc) {
String text = PINK + "- " + PURPLE + "Stages" + PINK + " -\n";
int stages = getStages(cc);
for(int i = 1; i <= stages; i++){
text += BOLD + "" + GREEN + i + ". " + RESET + GOLD + "Edit Stage " + i + "\n";
}
stages++;
text += "\n" + BOLD + "" + GREEN + stages + ". " + RESET + YELLOW + "Add new Stage";
stages++;
text += "\n" + BOLD + "" + BLUE + stages + ". " + RESET + YELLOW + "Done";
return text;
}
@Override
public Prompt acceptInput(ConversationContext cc, String string) {
int i;
try{
i = Integer.parseInt(string);
}catch(Exception e){
return new StagesPrompt(questFactory);
}
int stages = getStages(cc);
if(i < 0)
return new StagesPrompt(questFactory);
else if(i < (stages + 1) && i > 0)
return new CreateStagePrompt((i), questFactory, questFactory.quests.citizens);
else if(i == (stages + 1))
return new CreateStagePrompt((stages + 1), questFactory, questFactory.quests.citizens);
else if(i == (stages + 2))
return questFactory.returnToMenu();
else
return new StagesPrompt(questFactory);
}
public static int getStages(ConversationContext cc){
int num = 1;
while(true){
if(cc.getSessionData("stage" + num) != null)
num++;
else
break;
}
return (num - 1);
}
public static void deleteStage(ConversationContext cc, int stageNum){
int stages = getStages(cc);
int current = stageNum;
String pref = "stage" + current;
String newPref;
boolean last = false;
if(stageNum == stages)
last = true;
while(true){
if(!last){
current++;
if(current > stages)
break;
pref = "stage" + current;
newPref = "stage" + (current - 1);
cc.setSessionData(newPref + "breakIds", cc.getSessionData(pref + "breakIds"));
cc.setSessionData(newPref + "breakAmounts", cc.getSessionData(pref + "breakAmounts"));
cc.setSessionData(newPref + "damageIds", cc.getSessionData(pref + "damageIds"));
cc.setSessionData(newPref + "damageAmounts", cc.getSessionData(pref + "damageAmounts"));
cc.setSessionData(newPref + "placeIds", cc.getSessionData(pref + "placeIds"));
cc.setSessionData(newPref + "placeAmounts", cc.getSessionData(pref + "placeAmounts"));
cc.setSessionData(newPref + "useIds", cc.getSessionData(pref + "useIds"));
cc.setSessionData(newPref + "useAmounts", cc.getSessionData(pref + "useAmounts"));
cc.setSessionData(newPref + "cutIds", cc.getSessionData(pref + "cutIds"));
cc.setSessionData(newPref + "cutAmounts", cc.getSessionData(pref + "cutAmounts"));
cc.setSessionData(newPref + "fish", cc.getSessionData(pref + "fish"));
cc.setSessionData(newPref + "playerKill", cc.getSessionData(pref + "playerKill"));
cc.setSessionData(newPref + "enchantTypes", cc.getSessionData(pref + "enchantTypes"));
cc.setSessionData(newPref + "enchantIds", cc.getSessionData(pref + "enchantIds"));
cc.setSessionData(newPref + "enchantAmounts", cc.getSessionData(pref + "enchantAmounts"));
cc.setSessionData(newPref + "deliveryIds", cc.getSessionData(pref + "deliveryIds"));
cc.setSessionData(newPref + "deliveryAmounts", cc.getSessionData(pref + "deliveryAmounts"));
cc.setSessionData(newPref + "deliveryNPCs", cc.getSessionData(pref + "deliveryNPCs"));
cc.setSessionData(newPref + "deliveryMessages", cc.getSessionData(pref + "deliveryMessages"));
cc.setSessionData(newPref + "npcIdsToTalkTo", cc.getSessionData(pref + "npcIdsToTalkTo"));
cc.setSessionData(newPref + "mobTypes", cc.getSessionData(pref + "mobTypes"));
cc.setSessionData(newPref + "mobAmounts", cc.getSessionData(pref + "mobAmounts"));
cc.setSessionData(newPref + "killLocations", cc.getSessionData(pref + "killLocations"));
cc.setSessionData(newPref + "killLocationRadii", cc.getSessionData(pref + "killLocationRadii"));
cc.setSessionData(newPref + "killLocationNames", cc.getSessionData(pref + "killLocationNames"));
cc.setSessionData(newPref + "reachLocations", cc.getSessionData(pref + "reachLocations"));
cc.setSessionData(newPref + "reachLocationRadii", cc.getSessionData(pref + "reachLocationRadii"));
cc.setSessionData(newPref + "reachLocationNames", cc.getSessionData(pref + "reachLocationNames"));
cc.setSessionData(newPref + "tameTypes", cc.getSessionData(pref + "tameTypes"));
cc.setSessionData(newPref + "tameAmounts", cc.getSessionData(pref + "tameAmounts"));
cc.setSessionData(newPref + "shearColors", cc.getSessionData(pref + "shearColors"));
cc.setSessionData(newPref + "shearAmounts", cc.getSessionData(pref + "shearAmounts"));
cc.setSessionData(newPref + "event", cc.getSessionData(pref + "event"));
cc.setSessionData(newPref + "delay", cc.getSessionData(pref + "delay"));
cc.setSessionData(newPref + "delayMessage", cc.getSessionData(pref + "delayMessage"));
cc.setSessionData(newPref + "denizen", cc.getSessionData(pref + "denizen"));
}
cc.setSessionData(pref + "breakIds", null);
cc.setSessionData(pref + "breakAmounts", null);
cc.setSessionData(pref + "damageIds", null);
cc.setSessionData(pref + "damageAmounts", null);
cc.setSessionData(pref + "placeIds", null);
cc.setSessionData(pref + "placeAmounts", null);
cc.setSessionData(pref + "useIds", null);
cc.setSessionData(pref + "useAmounts", null);
cc.setSessionData(pref + "cutIds", null);
cc.setSessionData(pref + "cutAmounts", null);
cc.setSessionData(pref + "fish", null);
cc.setSessionData(pref + "playerKill", null);
cc.setSessionData(pref + "enchantTypes", null);
cc.setSessionData(pref + "enchantIds", null);
cc.setSessionData(pref + "enchantAmounts", null);
cc.setSessionData(pref + "deliveryIds", null);
cc.setSessionData(pref + "deliveryAmounts", null);
cc.setSessionData(pref + "deliveryNPCs", null);
cc.setSessionData(pref + "deliveryMessages", null);
cc.setSessionData(pref + "npcIdsToTalkTo", null);
cc.setSessionData(pref + "mobTypes", null);
cc.setSessionData(pref + "mobAmounts", null);
cc.setSessionData(pref + "killLocations", null);
cc.setSessionData(pref + "killLocationRadii", null);
cc.setSessionData(pref + "killLocationNames", null);
cc.setSessionData(pref + "reachLocations", null);
cc.setSessionData(pref + "reachLocationRadii", null);
cc.setSessionData(pref + "reachLocationNames", null);
cc.setSessionData(pref + "tameTypes", null);
cc.setSessionData(pref + "tameAmounts", null);
cc.setSessionData(pref + "shearColors", null);
cc.setSessionData(pref + "shearAmounts", null);
cc.setSessionData(pref + "event", null);
cc.setSessionData(pref + "delay", null);
cc.setSessionData(pref + "delayMessage", null);
cc.setSessionData(pref + "denizen", null);
if(last)
break;
}
if(!last)
cc.setSessionData("stage" + (current - 1), null);
else
cc.setSessionData("stage" + (current), null);
}
}

View File

@ -0,0 +1,52 @@
stage#breakIds
stage#breakAmounts
stage#damageIds
stage#damageAmounts
stage#placeIds
stage#placeAmounts
stage#useIds
stage#useAmounts
stage#cutIds
stage#cutAmounts
stage#fish
stage#playerKill
stage#enchantTypes
stage#enchantIds
stage#enchantAmounts
stage#deliveryIds
stage#deliveryAmounts
stage#deliveryNPCs
stage#deliveryMessages
stage#npcIdsToTalkTo
stage#mobTypes
stage#mobAmounts
stage#killLocations
stage#killLocationRadii
stage#killLocationNames
stage#reachLocations
stage#reachLocationRadii
stage#reachLocationNames
stage#tameTypes
stage#tameAmounts
stage#shearColors
stage#shearAmounts
stage#event
stage#delay
stage#delayMessage
stage#denizen

View File

@ -1,71 +1,77 @@
name: Quests
main: me.blackvein.quests.Quests
version: 1.5.1c
description: Player questing system
website: http://dev.bukkit.org/server-mods/quests/
dev-url: https://github.com/Blackvein/Quests/
authors: [Blackvein]
soft-depend: [Citizens, Vault]
permissions:
quests.quest:
description: View current Quest objectives
default: true
quests.questinfo:
description: View information about a Quest
default: true
quests.quests:
description: View Quests help
default: true
quests.list:
description: List Quests
default: true
quests.take:
description: Accept a Quest via command
default: true
quests.quit:
description: Quit current Quest
default: true
quests.stats:
description: View Questing statistics
default: true
quests.top:
description: View Questing leaderboards
default: true
quests.info:
description: View plugin information
default: true
quests.admin:
description: Base Questsadmin command
default: op
quests.admin.give:
description: Force a player to take a Quest (Overrides requirements)
default: op
quests.admin.quit:
description: Force a player to quit their current Quest
default: op
quests.admin.points:
description: Set a players Quest Points
default: op
quests.admin.finish:
description: Immediately force Quest completion for a player
default: op
quests.admin.nextstage:
description: Immediately force Stage completion for a player
default: op
quests.admin.reload:
description: Reload all Quests
default: op
commands:
quests:
description: Quests command
permission: quests.quests
questadmin:
description: Quests admin command
permission: quests.admin
aliases: [questsadmin]
quest:
description: Quest command
permission: quests.quest
editor:
description: Editor
name: Quests
main: me.blackvein.quests.Quests
version: 1.5.4
description: Player questing system
website: http://dev.bukkit.org/server-mods/quests/
dev-url: https://github.com/Blackvein/Quests/
authors: [Blackvein]
soft-depend: [Citizens, Vault]
permissions:
quests.quest:
description: View current Quest objectives
default: true
quests.questinfo:
description: View information about a Quest
default: true
quests.quests:
description: View Quests help
default: true
quests.list:
description: List Quests
default: true
quests.take:
description: Accept a Quest via command
default: true
quests.quit:
description: Quit current Quest
default: true
quests.stats:
description: View Questing statistics
default: true
quests.top:
description: View Questing leaderboards
default: true
quests.info:
description: View plugin information
default: true
quests.admin:
description: Base Questsadmin command
default: op
quests.admin.give:
description: Force a player to take a Quest (Overrides requirements)
default: op
quests.admin.quit:
description: Force a player to quit their current Quest
default: op
quests.admin.points:
description: Set a players Quest Points
default: op
quests.admin.finish:
description: Immediately force Quest completion for a player
default: op
quests.admin.nextstage:
description: Immediately force Stage completion for a player
default: op
quests.admin.reload:
description: Reload all Quests
default: op
quests.editor.create:
description: Create new Quests
default: op
quests.editor.events:
description: Create/Edit/Delete Events
default: op
commands:
quests:
description: Quests command
permission: quests.quests
questadmin:
description: Quests admin command
permission: quests.admin
aliases: [questsadmin]
quest:
description: Quest command
permission: quests.quest
events:
description: Events
permission: quests.editor

View File

@ -1,53 +1,58 @@
quests:
Miner:
name: 'Stone Miner'
ask-message: '<yellow>Mine <purple>10<yellow> blocks of <purple>Stone<yellow>, and retrieve <purple>10<yellow> pieces of <purple>Cobblestone<yellow>.'
finish-message: '<yellow>Well done. Here is your reward.'
requirements:
item-ids: [270]
item-amounts: [1]
remove-items: [false]
fail-requirement-message: '<red>You must have a <purple>Wooden Pickaxe<red> first.'
stages:
ordered:
1:
break-block-ids: [1]
break-block-amounts: [10]
collect-item-ids: [4]
collect-item-amounts: [10]
quest-items: [true]
rewards:
money: 1000
quest-points: 1
Hunter:
name: 'Mob Hunter'
ask-message: '<yellow>Kill an assortment of Mobs.'
finish-message: '<yellow>Excellent. Here is a <purple>Diamond Sword<yellow>.'
requirements:
quests: [Stone Miner]
fail-requirement-message: '<red>Complete <purple>Stone Miner<red> first.'
stages:
ordered:
1:
mobs-to-kill: [Pig]
mob-amounts: [3]
finished: '<yellow>Now kill <purple>2 Zombies<yellow>.'
2:
mobs-to-kill: [Zombie]
mob-amounts: [2]
finished: '<yellow>Finally, kill <purple>1 Skeleton<yellow>.'
3:
mobs-to-kill: [Skeleton]
mob-amounts: [1]
rewards:
item-ids: [276]
item-amounts: [1]
exp: 100
quests:
Miner:
name: 'Stone Miner'
ask-message: '<yellow>Could you mine <purple>10<yellow> blocks of <purple>Stone<yellow>, and deliver the <purple>10<yellow> pieces of <purple>Cobblestone<yellow> to me?.'
finish-message: '<yellow>Well done. Here is your reward.'
redo-delay: 1800000
requirements:
item-ids:
- 270
item-amounts:
- 1
remove-items:
- false
fail-requirement-message: '<red>You must have a <purple>Wooden Pickaxe<red> first.'
stages:
ordered:
1:
break-block-ids:
- 1
break-block-amounts:
- 10
rewards:
money: 1000
quest-points: 1
Hunter:
name: 'Mob Hunter'
ask-message: '<yellow>Kill an assortment of Mobs.'
finish-message: '<yellow>Excellent. Here is a <purple>Diamond Sword<yellow>.'
requirements:
quests:
- Stone Miner
fail-requirement-message: '<red>Complete <purple>Stone Miner<red> first.'
stages:
ordered:
1:
mobs-to-kill:
- Pig
mob-amounts:
- 3
2:
mobs-to-kill:
- Zombie
mob-amounts:
- 2
3:
mobs-to-kill:
- Skeleton
mob-amounts:
- 1
rewards:
item-ids: [276]
item-amounts: [1]
exp: 100
quest-points: 1