mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-26 19:17:50 +01:00
Update 1.6
Git has been updated
This commit is contained in:
parent
5e498424d7
commit
41252807dd
@ -1,34 +1,35 @@
|
|||||||
# Quests config
|
# Quests config
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# allow-command-questing: true/false
|
# allow-command-questing: true/false
|
||||||
# Should we allow players to take Quests via commands?
|
# Should we allow players to take Quests via commands?
|
||||||
#
|
#
|
||||||
# allow-command-quests-with-npcs: true/false
|
# allow-command-quests-with-npcs: true/false
|
||||||
# Should we allow players to take Quests via commands, that have NPCs as quest starters?
|
# Should we allow players to take Quests via commands, that have NPCs as quest starters?
|
||||||
#
|
#
|
||||||
# show-requirements: true/false
|
# show-requirements: true/false
|
||||||
# Should players be told the exact requirements of a Quest when they look at its info (via command)?
|
# Should players be told the exact requirements of a Quest when they look at its info (via command)?
|
||||||
#
|
#
|
||||||
# allow-quitting: true/false
|
# allow-quitting: true/false
|
||||||
# Should players be allowed to quit a Quest after they've taken it?
|
# Should players be allowed to quit a Quest after they've taken it?
|
||||||
#
|
#
|
||||||
# debug-mode: true/false
|
# debug-mode: true/false
|
||||||
# Should debugging information be printed out to console?
|
# Should debugging information be printed out to console?
|
||||||
#
|
#
|
||||||
# kill-time: number
|
# kill-time: number
|
||||||
# How long (in seconds) should a player have to wait before they can kill the same player for a Quest?
|
# 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-questing: true
|
||||||
allow-command-quests-with-npcs: false
|
allow-command-quests-with-npcs: false
|
||||||
show-requirements: true
|
show-requirements: true
|
||||||
allow-quitting: true
|
allow-quitting: true
|
||||||
debug-mode: false
|
debug-mode: false
|
||||||
kill-delay: 600
|
kill-delay: 600
|
||||||
quester-blacklist:
|
snoop: true
|
||||||
- "SomeGuy12345"
|
quester-blacklist:
|
||||||
- "somePrefix*"
|
- "SomeGuy12345"
|
||||||
- "*someSuffix"
|
- "somePrefix*"
|
||||||
- "*someRegex*"
|
- "*someSuffix"
|
||||||
|
- "*someRegex*"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
2673
src/me/blackvein/quests/EventFactory.java
Normal file
2673
src/me/blackvein/quests/EventFactory.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,107 +1,130 @@
|
|||||||
package me.blackvein.quests;
|
package me.blackvein.quests;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCDespawnEvent;
|
import net.citizensnpcs.api.event.NPCDespawnEvent;
|
||||||
import net.citizensnpcs.api.event.NPCRightClickEvent;
|
import net.citizensnpcs.api.event.NPCRightClickEvent;
|
||||||
import org.bukkit.ChatColor;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import org.bukkit.conversations.Conversable;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.conversations.Conversable;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
public class NpcListener implements Listener {
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
Quests plugin;
|
public class NpcListener implements Listener {
|
||||||
|
|
||||||
public NpcListener(Quests newPlugin) {
|
Quests plugin;
|
||||||
|
|
||||||
plugin = newPlugin;
|
public NpcListener(Quests newPlugin) {
|
||||||
|
|
||||||
}
|
plugin = newPlugin;
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
}
|
||||||
public void onNPCRightClick(NPCRightClickEvent evt) {
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
if (plugin.questNPCs.contains(evt.getNPC())) {
|
public void onNPCRightClick(NPCRightClickEvent evt) {
|
||||||
|
|
||||||
final Player player = evt.getClicker();
|
final Player player = evt.getClicker();
|
||||||
|
final Quester quester = plugin.getQuester(player.getName());
|
||||||
if (plugin.checkQuester(player.getName()) == false) {
|
boolean delivery = false;
|
||||||
|
|
||||||
final Quester quester = plugin.getQuester(player.getName());
|
if(quester.hasObjective("deliverItem") && player.getItemInHand() != null){
|
||||||
if (quester.hasObjective("talkToNPC")) {
|
|
||||||
|
ItemStack hand = player.getItemInHand();
|
||||||
quester.interactWithNPC(evt.getNPC());
|
if(quester.itemsDelivered.containsKey(hand.getType())){
|
||||||
|
|
||||||
} else {
|
NPC clicked = evt.getNPC();
|
||||||
|
|
||||||
for (final Quest q : plugin.quests) {
|
for(NPC n : quester.currentStage.itemDeliveryTargets){
|
||||||
|
if(n.getId() == clicked.getId()){
|
||||||
if (q.npcStart != null && player.hasPermission("quests.quest")) {
|
quester.deliverItem(hand);
|
||||||
|
delivery = true;
|
||||||
if (q.npcStart.equals(evt.getNPC()) && quester.completedQuests.contains(q.name) == false) {
|
break;
|
||||||
|
}
|
||||||
if (quester.currentQuest == null) {
|
}
|
||||||
|
|
||||||
quester.questToTake = q.name;
|
}
|
||||||
|
|
||||||
String s =
|
}
|
||||||
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
|
||||||
+ "\n"
|
if (plugin.questNPCs.contains(evt.getNPC()) && delivery == false) {
|
||||||
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
|
||||||
player.sendMessage(s);
|
if (plugin.checkQuester(player.getName()) == false) {
|
||||||
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
if (quester.hasObjective("talkToNPC")) {
|
||||||
|
|
||||||
} else if (quester.currentQuest.equals(q) == false) {
|
quester.interactWithNPC(evt.getNPC());
|
||||||
|
|
||||||
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
|
} else {
|
||||||
|
|
||||||
}
|
for (Quest q : plugin.quests) {
|
||||||
|
|
||||||
break;
|
if (q.npcStart != null && player.hasPermission("quests.quest")) {
|
||||||
|
|
||||||
} else if (q.npcStart.equals(evt.getNPC()) && quester.completedQuests.contains(q.name) == true) {
|
if (q.npcStart.equals(evt.getNPC()) && quester.completedQuests.contains(q.name) == false) {
|
||||||
|
|
||||||
if (quester.currentQuest == null) {
|
if (quester.currentQuest == null) {
|
||||||
|
|
||||||
if (quester.getDifference(q) > 0) {
|
quester.questToTake = q.name;
|
||||||
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 {
|
String s =
|
||||||
|
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
||||||
quester.questToTake = q.name;
|
+ "\n"
|
||||||
|
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
||||||
String s =
|
player.sendMessage(s);
|
||||||
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||||
+ "\n"
|
|
||||||
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
} else if (quester.currentQuest.equals(q) == false) {
|
||||||
player.sendMessage(s);
|
|
||||||
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (quester.currentQuest.equals(q) == false) {
|
break;
|
||||||
|
|
||||||
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
|
} else if (q.npcStart.equals(evt.getNPC()) && quester.completedQuests.contains(q.name) == true) {
|
||||||
|
|
||||||
}
|
if (quester.currentQuest == null) {
|
||||||
|
|
||||||
break;
|
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();
|
||||||
|
}
|
||||||
@EventHandler
|
|
||||||
public void onNPCDespawn(NPCDespawnEvent evt) {
|
} 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
@ -1,454 +1,385 @@
|
|||||||
package me.blackvein.quests;
|
package me.blackvein.quests;
|
||||||
|
|
||||||
import com.herocraftonline.heroes.characters.classes.HeroClass.ExperienceType;
|
import java.util.EnumMap;
|
||||||
import java.util.EnumMap;
|
import java.util.LinkedList;
|
||||||
import java.util.LinkedList;
|
import java.util.List;
|
||||||
import java.util.List;
|
import java.util.Map;
|
||||||
import java.util.Map;
|
import java.util.Map.Entry;
|
||||||
import java.util.Map.Entry;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
|
||||||
|
public class Quest {
|
||||||
public class Quest {
|
|
||||||
|
String name;
|
||||||
String name;
|
String description;
|
||||||
String description;
|
String finished;
|
||||||
String finished;
|
int redoDelay = -1;
|
||||||
int redoDelay = -1;
|
LinkedList<Stage> stages = new LinkedList<Stage>();
|
||||||
LinkedList<Stage> stages = new LinkedList<Stage>();
|
NPC npcStart;
|
||||||
NPC npcStart;
|
Location blockStart;
|
||||||
Location blockStart;
|
Quests plugin;
|
||||||
Quests plugin;
|
Map<Material, Integer> questItems = new EnumMap<Material, Integer>(Material.class);
|
||||||
Map<Material, Integer> questItems = new EnumMap<Material, Integer>(Material.class);
|
|
||||||
|
//Requirements
|
||||||
//Requirements
|
int moneyReq = 0;
|
||||||
int moneyReq = 0;
|
int questPointsReq = 0;
|
||||||
int questPointsReq = 0;
|
|
||||||
|
List<Integer> itemIds = new LinkedList<Integer>();
|
||||||
List<Integer> itemIds = new LinkedList<Integer>();
|
List<Integer> itemAmounts = new LinkedList<Integer>();
|
||||||
List<Integer> itemAmounts = new LinkedList<Integer>();
|
List<Boolean> removeItems = new LinkedList<Boolean>();
|
||||||
List<Boolean> removeItems = new LinkedList<Boolean>();
|
|
||||||
|
List<String> neededQuests = new LinkedList<String>();
|
||||||
List<String> neededQuests = new LinkedList<String>();
|
|
||||||
|
List<String> permissionReqs = new LinkedList<String>();
|
||||||
List<String> permissionReqs = new LinkedList<String>();
|
|
||||||
|
String failRequirements;
|
||||||
String failRequirements;
|
//
|
||||||
//
|
|
||||||
|
//Rewards
|
||||||
//Rewards
|
int moneyReward = 0;
|
||||||
int moneyReward = 0;
|
int questPoints = 0;
|
||||||
int questPoints = 0;
|
int exp = 0;
|
||||||
int exp = 0;
|
List<String> commands = new LinkedList<String>();
|
||||||
List<String> commands = new LinkedList<String>();
|
List<String> permissions = new LinkedList<String>();
|
||||||
List<String> permissions = new LinkedList<String>();
|
LinkedList<ItemStack> itemRewards = new LinkedList<ItemStack>();
|
||||||
LinkedList<ItemStack> itemRewards = new LinkedList<ItemStack>();
|
LinkedList<Integer> itemRewardAmounts = new LinkedList<Integer>();
|
||||||
LinkedList<Integer> itemRewardAmounts = new LinkedList<Integer>();
|
|
||||||
//Heroes
|
//mcMMO
|
||||||
int heroesExp = 0;
|
List<String> mcmmoSkills = new LinkedList<String>();
|
||||||
String heroesClass = null;
|
List<Integer> mcmmoAmounts = new LinkedList<Integer>();
|
||||||
String heroesSecClass = null;
|
//
|
||||||
//
|
|
||||||
|
//
|
||||||
//mcMMO
|
public void nextStage(Quester q){
|
||||||
List<String> mcmmoSkills = new LinkedList<String>();
|
|
||||||
List<Integer> mcmmoAmounts = new LinkedList<Integer>();
|
if(q.currentStage.delay < 0){
|
||||||
//
|
|
||||||
//
|
Player player = plugin.getServer().getPlayerExact(q.name);
|
||||||
public void nextStage(Quester q){
|
|
||||||
|
if(stages.indexOf(q.currentStage) == (stages.size() - 1)){
|
||||||
if(q.currentStage.delay < 0){
|
|
||||||
|
if(q.currentStage.script != null)
|
||||||
Player player = plugin.getServer().getPlayerExact(q.name);
|
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
|
||||||
|
if(q.currentStage.event != null)
|
||||||
if(stages.indexOf(q.currentStage) == (stages.size() - 1)){
|
q.currentStage.event.happen(q);
|
||||||
|
|
||||||
if(q.currentStage.script != null)
|
completeQuest(q);
|
||||||
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
|
|
||||||
if(q.currentStage.event != null)
|
}else {
|
||||||
q.currentStage.event.happen(player);
|
|
||||||
|
q.reset();
|
||||||
completeQuest(q);
|
if(q.currentStage.script != null)
|
||||||
|
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
|
||||||
}else {
|
if(q.currentStage.event != null)
|
||||||
|
q.currentStage.event.happen(q);
|
||||||
q.reset();
|
q.currentStage = stages.get(stages.indexOf(q.currentStage) + 1);
|
||||||
player.sendMessage(plugin.parseString(q.currentStage.finished, q.currentQuest));
|
q.addEmpties();
|
||||||
if(q.currentStage.script != null)
|
|
||||||
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
|
for (Entry e : q.currentStage.itemsToCraft.entrySet()) {
|
||||||
if(q.currentStage.event != null)
|
|
||||||
q.currentStage.event.happen(player);
|
if ((Boolean) e.getValue() == true) {
|
||||||
q.currentStage = stages.get(stages.indexOf(q.currentStage) + 1);
|
|
||||||
q.addEmpties();
|
Map<Material, Integer> tempMap = (Map<Material, Integer>) e.getKey();
|
||||||
|
for (Entry e2 : tempMap.entrySet()) {
|
||||||
for (Entry e : q.currentStage.itemsToCollect.entrySet()) {
|
|
||||||
|
questItems.put((Material) e2.getKey(), (Integer) e2.getValue());
|
||||||
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);
|
||||||
}
|
|
||||||
|
}
|
||||||
for (Entry e : q.currentStage.itemsToCraft.entrySet()) {
|
|
||||||
|
}
|
||||||
if ((Boolean) e.getValue() == true) {
|
|
||||||
|
q.delayStartTime = 0;
|
||||||
Map<Material, Integer> tempMap = (Map<Material, Integer>) e.getKey();
|
q.delayTimeLeft = -1;
|
||||||
for (Entry e2 : tempMap.entrySet()) {
|
|
||||||
|
}else{
|
||||||
questItems.put((Material) e2.getKey(), (Integer) e2.getValue());
|
|
||||||
|
q.startStageTimer();
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
public String getName(){
|
||||||
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
|
return name;
|
||||||
for(String s : q.getObjectives()){
|
}
|
||||||
|
|
||||||
player.sendMessage(s);
|
public boolean testRequirements(Player player){
|
||||||
|
|
||||||
}
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
|
|
||||||
}
|
if(moneyReq != 0 && Quests.economy.getBalance(player.getName()) < moneyReq)
|
||||||
|
return false;
|
||||||
q.delayStartTime = 0;
|
|
||||||
q.delayTimeLeft = -1;
|
PlayerInventory inventory = player.getInventory();
|
||||||
|
int num = 0;
|
||||||
}else{
|
|
||||||
|
for(int i : itemIds){
|
||||||
q.startStageTimer();
|
|
||||||
|
for(ItemStack stack : inventory.getContents()){
|
||||||
}
|
|
||||||
|
if(stack != null){
|
||||||
}
|
if(i == stack.getTypeId())
|
||||||
|
num += stack.getAmount();
|
||||||
public String getName(){
|
}
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean testRequirements(Player player){
|
if(num < itemAmounts.get(itemIds.indexOf(i)))
|
||||||
|
return false;
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
|
||||||
|
num = 0;
|
||||||
if(moneyReq != 0 && Quests.economy.getBalance(player.getName()) < moneyReq)
|
|
||||||
return false;
|
}
|
||||||
|
|
||||||
PlayerInventory inventory = player.getInventory();
|
for(String s : permissionReqs){
|
||||||
int num = 0;
|
|
||||||
|
if(player.hasPermission(s) == false)
|
||||||
for(int i : itemIds){
|
return false;
|
||||||
|
|
||||||
for(ItemStack stack : inventory.getContents()){
|
}
|
||||||
|
|
||||||
if(stack != null){
|
if(quester.questPoints < questPointsReq)
|
||||||
if(i == stack.getTypeId())
|
return false;
|
||||||
num += stack.getAmount();
|
|
||||||
}
|
if(quester.completedQuests.containsAll(neededQuests) == false)
|
||||||
|
return false;
|
||||||
}
|
|
||||||
|
return true;
|
||||||
if(num < itemAmounts.get(itemIds.indexOf(i)))
|
|
||||||
return false;
|
}
|
||||||
|
|
||||||
num = 0;
|
public void completeQuest(Quester q){
|
||||||
|
|
||||||
}
|
Player player = plugin.getServer().getPlayerExact(q.name);
|
||||||
|
q.reset();
|
||||||
for(String s : permissionReqs){
|
q.completedQuests.add(name);
|
||||||
|
String none = ChatColor.GRAY + "- (None)";
|
||||||
if(player.hasPermission(s) == false)
|
player.sendMessage(Quests.parseString(finished, q.currentQuest));
|
||||||
return false;
|
if(moneyReward > 0 && Quests.economy != null){
|
||||||
|
Quests.economy.depositPlayer(q.name, moneyReward);
|
||||||
}
|
none = null;
|
||||||
|
}
|
||||||
if(quester.questPoints < questPointsReq)
|
if(redoDelay > -1)
|
||||||
return false;
|
q.completedTimes.put(this.name, System.currentTimeMillis());
|
||||||
|
|
||||||
if(quester.completedQuests.containsAll(neededQuests) == false)
|
for(ItemStack i : itemRewards){
|
||||||
return false;
|
Quests.addItem(player, i);
|
||||||
|
none = null;
|
||||||
return true;
|
}
|
||||||
|
|
||||||
}
|
for(Entry entry : questItems.entrySet()){
|
||||||
|
|
||||||
public void completeQuest(Quester q){
|
Material material = (Material) entry.getKey();
|
||||||
|
int amount = (Integer) entry.getValue();
|
||||||
Player player = plugin.getServer().getPlayerExact(q.name);
|
for(ItemStack stack : player.getInventory().getContents()){
|
||||||
q.reset();
|
|
||||||
q.completedQuests.add(name);
|
if(stack != null){
|
||||||
String none = ChatColor.GRAY + "- (None)";
|
|
||||||
player.sendMessage(plugin.parseString(finished, q.currentQuest));
|
if(stack.getType().equals(material)){
|
||||||
if(moneyReward > 0 && Quests.economy != null){
|
|
||||||
Quests.economy.depositPlayer(q.name, moneyReward);
|
if(stack.getAmount() > amount){
|
||||||
none = null;
|
|
||||||
}
|
stack.setAmount(stack.getAmount() - amount);
|
||||||
if(redoDelay > -1)
|
break;
|
||||||
q.completedTimes.put(this.name, System.currentTimeMillis());
|
|
||||||
|
}else{
|
||||||
for(ItemStack i : itemRewards){
|
|
||||||
Quests.addItem(player, i);
|
amount -= stack.getAmount();
|
||||||
none = null;
|
stack.setAmount(0);
|
||||||
}
|
if(amount == 0)
|
||||||
|
break;
|
||||||
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){
|
|
||||||
|
for(String s : commands){
|
||||||
stack.setAmount(stack.getAmount() - amount);
|
|
||||||
break;
|
s = s.replaceAll("<player>", player.getName());
|
||||||
|
|
||||||
}else{
|
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), s);
|
||||||
|
none = null;
|
||||||
amount -= stack.getAmount();
|
|
||||||
stack.setAmount(0);
|
}
|
||||||
if(amount == 0)
|
|
||||||
break;
|
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;
|
||||||
|
|
||||||
for(String s : commands){
|
}
|
||||||
|
|
||||||
s = s.replaceAll("<player>", player.getName());
|
if(exp > 0){
|
||||||
|
player.giveExp(exp);
|
||||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), s);
|
none = null;
|
||||||
none = null;
|
}
|
||||||
|
|
||||||
}
|
player.sendMessage(ChatColor.GOLD + "**QUEST COMPLETE: " + ChatColor.YELLOW + q.currentQuest.name + ChatColor.GOLD + "**");
|
||||||
|
player.sendMessage(ChatColor.GREEN + "Rewards:");
|
||||||
for(String s : permissions){
|
|
||||||
|
if(questPoints > 0){
|
||||||
Quests.permission.playerAdd(player, s);
|
player.sendMessage("- " + ChatColor.DARK_GREEN + questPoints + " Quest Points");
|
||||||
none = null;
|
q.questPoints += questPoints;
|
||||||
|
none = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(String s : mcmmoSkills){
|
for(ItemStack i : itemRewards){
|
||||||
|
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + itemRewardAmounts.get(itemRewards.indexOf(i)));
|
||||||
Quests.mcmmo.getPlayerProfile(player.getName()).skillUp(Quests.getMcMMOSkill(s), mcmmoAmounts.get(mcmmoSkills.indexOf(s)));
|
none = null;
|
||||||
none = null;
|
}
|
||||||
|
|
||||||
}
|
if(moneyReward > 1){
|
||||||
|
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(true));
|
||||||
if(exp > 0){
|
none = null;
|
||||||
player.giveExp(exp);
|
}else if(moneyReward == 1){
|
||||||
none = null;
|
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(false));
|
||||||
}
|
none = null;
|
||||||
|
}
|
||||||
if(heroesExp > 0){
|
|
||||||
plugin.heroes.getCharacterManager().getHero(player).gainExp(heroesExp, ExperienceType.QUESTING, player.getLocation());
|
if(exp > 0){
|
||||||
none = null;
|
player.sendMessage("- " + ChatColor.DARK_GREEN + exp + ChatColor.DARK_PURPLE + " Experience");
|
||||||
}
|
none = null;
|
||||||
|
}
|
||||||
if(heroesClass != null){
|
|
||||||
plugin.heroes.getCharacterManager().getHero(player).changeHeroClass(plugin.heroes.getClassManager().getClass(heroesClass), false);
|
if(none != null){
|
||||||
none = null;
|
player.sendMessage(none);
|
||||||
}
|
}
|
||||||
|
q.currentQuest = null;
|
||||||
if(heroesSecClass != null){
|
q.currentStage = null;
|
||||||
plugin.heroes.getCharacterManager().getHero(player).changeHeroClass(plugin.heroes.getClassManager().getClass(heroesSecClass), true);
|
|
||||||
none = null;
|
q.saveData();
|
||||||
}
|
player.updateInventory();
|
||||||
player.sendMessage(ChatColor.GOLD + "**QUEST COMPLETE: " + ChatColor.YELLOW + q.currentQuest.name + ChatColor.GOLD + "**");
|
|
||||||
player.sendMessage(ChatColor.GREEN + "Rewards:");
|
}
|
||||||
|
|
||||||
if(questPoints > 0){
|
@Override
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + questPoints + " Quest Points");
|
public boolean equals(Object o){
|
||||||
q.questPoints += questPoints;
|
|
||||||
none = null;
|
if(o instanceof Quest){
|
||||||
}
|
|
||||||
|
Quest other = (Quest) o;
|
||||||
for(ItemStack i : itemRewards){
|
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + itemRewardAmounts.get(itemRewards.indexOf(i)));
|
if(other.blockStart != null && blockStart != null){
|
||||||
none = null;
|
if(other.blockStart.equals(blockStart) == false)
|
||||||
}
|
return false;
|
||||||
|
}else if(other.blockStart != null && blockStart == null){
|
||||||
if(moneyReward > 1){
|
return false;
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(true));
|
}else if(other.blockStart == null && blockStart != null)
|
||||||
none = null;
|
return false;
|
||||||
}else if(moneyReward == 1){
|
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(false));
|
for(String s : other.commands){
|
||||||
none = null;
|
|
||||||
}
|
if(commands.get(other.commands.indexOf(s)).equals(s) == false)
|
||||||
|
return false;
|
||||||
if(exp > 0){
|
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + exp + ChatColor.DARK_PURPLE + " Experience");
|
}
|
||||||
none = null;
|
|
||||||
}
|
if(other.description.equals(description) == false)
|
||||||
|
return false;
|
||||||
if(heroesExp > 0){
|
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + heroesExp + ChatColor.DARK_PURPLE + " Heroes Exp");
|
if(other.exp != exp)
|
||||||
none = null;
|
return false;
|
||||||
}
|
|
||||||
|
if(other.failRequirements != null && failRequirements != null){
|
||||||
if(heroesClass != null){
|
if(other.failRequirements.equals(failRequirements) == false)
|
||||||
player.sendMessage("- " + ChatColor.DARK_PURPLE + heroesClass + ChatColor.AQUA + " Heroes Class");
|
return false;
|
||||||
none = null;
|
}else if(other.failRequirements != null && failRequirements == null){
|
||||||
}
|
return false;
|
||||||
|
}else if(other.failRequirements == null && failRequirements != null)
|
||||||
if(heroesSecClass != null){
|
return false;
|
||||||
player.sendMessage("- " + ChatColor.DARK_PURPLE + heroesSecClass + ChatColor.AQUA + " Heroes Secondary Class");
|
|
||||||
none = null;
|
if(other.finished.equals(finished) == false)
|
||||||
}
|
return false;
|
||||||
|
|
||||||
if(none != null){
|
if(other.itemAmounts.equals(itemAmounts) == false)
|
||||||
player.sendMessage(none);
|
return false;
|
||||||
}
|
|
||||||
q.currentQuest = null;
|
if(other.itemIds.equals(itemIds) == false)
|
||||||
q.currentStage = null;
|
return false;
|
||||||
|
|
||||||
q.saveData();
|
if(other.itemRewards.equals(itemRewards) == false)
|
||||||
player.updateInventory();
|
return false;
|
||||||
|
|
||||||
}
|
if(other.mcmmoAmounts.equals(mcmmoAmounts) == false)
|
||||||
|
return false;
|
||||||
@Override
|
|
||||||
public boolean equals(Object o){
|
if(other.mcmmoSkills.equals(mcmmoSkills) == false)
|
||||||
|
return false;
|
||||||
if(o instanceof Quest){
|
|
||||||
|
if(other.moneyReq != moneyReq)
|
||||||
Quest other = (Quest) o;
|
return false;
|
||||||
|
|
||||||
if(other.blockStart != null && blockStart != null){
|
if(other.moneyReward != moneyReward)
|
||||||
if(other.blockStart.equals(blockStart) == false)
|
return false;
|
||||||
return false;
|
|
||||||
}else if(other.blockStart != null && blockStart == null){
|
if(other.name.equals(name) == false)
|
||||||
return false;
|
return false;
|
||||||
}else if(other.blockStart == null && blockStart != null)
|
|
||||||
return false;
|
if(other.neededQuests.equals(neededQuests) == false)
|
||||||
|
return false;
|
||||||
for(String s : other.commands){
|
|
||||||
|
if(other.npcStart != null && npcStart != null){
|
||||||
if(commands.get(other.commands.indexOf(s)).equals(s) == false)
|
if(other.npcStart.equals(npcStart) == false)
|
||||||
return false;
|
return false;
|
||||||
|
}else if(other.npcStart != null && npcStart == null){
|
||||||
}
|
return false;
|
||||||
|
}else if(other.npcStart == null && npcStart != null)
|
||||||
if(other.description.equals(description) == false)
|
return false;
|
||||||
return false;
|
|
||||||
|
if(other.permissionReqs.equals(permissionReqs) == false)
|
||||||
if(other.exp != exp)
|
return false;
|
||||||
return false;
|
|
||||||
|
if(other.permissions.equals(permissions) == false)
|
||||||
if(other.failRequirements != null && failRequirements != null){
|
return false;
|
||||||
if(other.failRequirements.equals(failRequirements) == false)
|
|
||||||
return false;
|
if(other.questItems.equals(questItems) == false)
|
||||||
}else if(other.failRequirements != null && failRequirements == null){
|
return false;
|
||||||
return false;
|
|
||||||
}else if(other.failRequirements == null && failRequirements != null)
|
if(other.questPoints != questPoints)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(other.finished.equals(finished) == false)
|
if(other.questPointsReq != questPointsReq)
|
||||||
return false;
|
|
||||||
|
if(other.redoDelay != redoDelay)
|
||||||
if(other.heroesClass != null && heroesClass != null){
|
return false;
|
||||||
if(other.heroesClass.equals(heroesClass) == false)
|
|
||||||
return false;
|
|
||||||
}else if(other.heroesClass != null && heroesClass == null){
|
if(other.stages.equals(stages) == false)
|
||||||
return false;
|
return false;
|
||||||
}else if(other.heroesClass == null && heroesClass != null)
|
|
||||||
return false;
|
}
|
||||||
|
|
||||||
if(other.heroesExp != heroesExp)
|
return true;
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,26 +1,17 @@
|
|||||||
package me.blackvein.quests;
|
package me.blackvein.quests;
|
||||||
|
|
||||||
import java.util.List;
|
import net.aufdemrand.denizen.scripts.ScriptRegistry;
|
||||||
import net.aufdemrand.denizen.scripts.ScriptEngine.QueueType;
|
import net.aufdemrand.denizen.scripts.containers.core.TaskScriptContainer;
|
||||||
import net.aufdemrand.denizen.scripts.ScriptHelper;
|
import org.bukkit.entity.Player;
|
||||||
import net.aufdemrand.denizen.triggers.AbstractTrigger;
|
|
||||||
import org.bukkit.entity.Player;
|
public class QuestTaskTrigger {
|
||||||
|
|
||||||
public class QuestTaskTrigger extends AbstractTrigger {
|
public boolean parseQuestTaskTrigger(String theScriptName, Player thePlayer) {
|
||||||
|
if (!ScriptRegistry.containsScript(theScriptName)) {
|
||||||
public boolean parseQuestTaskTrigger(String theScriptName, Player thePlayer) {
|
return false;
|
||||||
|
}
|
||||||
ScriptHelper sE = plugin.getScriptEngine().helper;
|
TaskScriptContainer task_script = ScriptRegistry.getScriptContainerAs(theScriptName, TaskScriptContainer.class);
|
||||||
|
task_script.runTaskScript(thePlayer, null, null);
|
||||||
if (theScriptName == null) return false;
|
return true;
|
||||||
|
}
|
||||||
List<String> theScript = sE.getScript(theScriptName + ".Script");
|
|
||||||
|
|
||||||
if (theScript.isEmpty()) return false;
|
|
||||||
|
|
||||||
sE.queueScriptEntries(thePlayer, sE.buildScriptEntries(thePlayer, theScript, theScriptName), QueueType.TASK);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,256 +1,286 @@
|
|||||||
package me.blackvein.quests;
|
package me.blackvein.quests;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.EnumMap;
|
||||||
import java.util.LinkedList;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.LinkedList;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import java.util.Map;
|
||||||
import org.bukkit.DyeColor;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
public class Stage {
|
|
||||||
|
public class Stage {
|
||||||
public String finished;
|
|
||||||
Map<Material, Integer> blocksToDamage = new EnumMap<Material, Integer>(Material.class);
|
Map<Material, Integer> blocksToDamage = new EnumMap<Material, Integer>(Material.class);
|
||||||
Map<Material, Integer> blocksToBreak = 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> 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> blocksToUse = new EnumMap<Material, Integer>(Material.class);
|
Map<Material, Integer> blocksToCut = new EnumMap<Material, Integer>(Material.class);
|
||||||
Map<Material, Integer> blocksToCut = new EnumMap<Material, Integer>(Material.class);
|
Integer fishToCatch;
|
||||||
Integer fishToCatch;
|
Integer playersToKill;
|
||||||
Integer playersToKill;
|
Map<Map<Enchantment, Material>, Integer> itemsToEnchant = new HashMap<Map<Enchantment, Material>, Integer>();
|
||||||
Map<Map<Enchantment, Material>, Integer> itemsToEnchant = new HashMap<Map<Enchantment, Material>, Integer>();
|
LinkedList<EntityType> mobsToKill = new LinkedList<EntityType>();
|
||||||
LinkedList<EntityType> mobsToKill = new LinkedList<EntityType>();
|
LinkedList<Integer> mobNumToKill = new LinkedList<Integer>();
|
||||||
LinkedList<Integer> mobNumToKill = new LinkedList<Integer>();
|
LinkedList<Location> locationsToKillWithin = new LinkedList<Location>();
|
||||||
LinkedList<Location> locationsToKillWithin = new LinkedList<Location>();
|
LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>();
|
||||||
LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>();
|
LinkedList<String> areaNames = new LinkedList<String>();
|
||||||
LinkedList<String> areaNames = new LinkedList<String>();
|
|
||||||
LinkedList<NPC> citizensToInteract = new LinkedList<NPC>(){
|
LinkedList<Material> itemsToDeliver = new LinkedList<Material>();
|
||||||
|
LinkedList<Integer> itemAmountsToDeliver = new LinkedList<Integer>();
|
||||||
@Override
|
LinkedList<NPC> itemDeliveryTargets = new LinkedList<NPC>(){
|
||||||
public boolean equals(Object o) {
|
|
||||||
|
@Override
|
||||||
if (o instanceof LinkedList) {
|
public boolean equals(Object o) {
|
||||||
|
|
||||||
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
|
if (o instanceof LinkedList) {
|
||||||
|
|
||||||
for (NPC n : this) {
|
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
|
||||||
|
|
||||||
NPC other = otherList.get(this.indexOf(n));
|
for (NPC n : this) {
|
||||||
if (other.getId() != n.getId()) {
|
|
||||||
return false;
|
NPC other = otherList.get(this.indexOf(n));
|
||||||
}
|
if (other.getId() != n.getId()) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
}
|
||||||
|
|
||||||
}
|
return true;
|
||||||
|
|
||||||
};
|
}
|
||||||
LinkedList<NPC> citizensToKill = new LinkedList<NPC>() {
|
|
||||||
|
};
|
||||||
@Override
|
ArrayList<String> deliverMessages = new ArrayList<String>();
|
||||||
public boolean equals(Object o) {
|
|
||||||
|
LinkedList<NPC> citizensToInteract = new LinkedList<NPC>(){
|
||||||
if (o instanceof LinkedList) {
|
|
||||||
|
@Override
|
||||||
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
|
public boolean equals(Object o) {
|
||||||
|
|
||||||
for (NPC n : this) {
|
if (o instanceof LinkedList) {
|
||||||
|
|
||||||
NPC other = otherList.get(this.indexOf(n));
|
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
|
||||||
if (other.getId() != n.getId()) {
|
|
||||||
return false;
|
for (NPC n : this) {
|
||||||
}
|
|
||||||
}
|
NPC other = otherList.get(this.indexOf(n));
|
||||||
|
if (other.getId() != n.getId()) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
return true;
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
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>();
|
LinkedList<NPC> citizensToKill = new LinkedList<NPC>() {
|
||||||
Map<EntityType, Integer> mobsToTame = new EnumMap<EntityType, Integer>(EntityType.class);
|
|
||||||
Map<DyeColor, Integer> sheepToShear = new EnumMap<DyeColor, Integer>(DyeColor.class);
|
@Override
|
||||||
Map<EnumMap<Material, Integer>, Boolean> itemsToCraft = new HashMap<EnumMap<Material, Integer>, Boolean>();
|
public boolean equals(Object o) {
|
||||||
String script;
|
|
||||||
Event event;
|
if (o instanceof LinkedList) {
|
||||||
long delay = -1;
|
|
||||||
String delayMessage = null;
|
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
|
||||||
|
|
||||||
@Override
|
for (NPC n : this) {
|
||||||
public boolean equals(Object o) {
|
|
||||||
|
NPC other = otherList.get(this.indexOf(n));
|
||||||
if (o instanceof Stage) {
|
if (other.getId() != n.getId()) {
|
||||||
|
return false;
|
||||||
Stage other = (Stage) o;
|
}
|
||||||
|
}
|
||||||
if (other.finished != null && finished != null) {
|
|
||||||
if (other.finished.equals(finished) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
return true;
|
||||||
} else if (other.finished != null && finished == null) {
|
|
||||||
return false;
|
}
|
||||||
} else if (other.finished == null && finished != null) {
|
|
||||||
return false;
|
};
|
||||||
}
|
LinkedList<Integer> citizenNumToKill = new LinkedList<Integer>();
|
||||||
|
LinkedList<Location> locationsToReach = new LinkedList<Location>();
|
||||||
if (other.blocksToDamage.equals(blocksToDamage) == false) {
|
LinkedList<Integer> radiiToReachWithin = new LinkedList<Integer>();
|
||||||
return false;
|
LinkedList<World> worldsToReachWithin = new LinkedList<World>();
|
||||||
}
|
LinkedList<String> locationNames = new LinkedList<String>();
|
||||||
|
Map<EntityType, Integer> mobsToTame = new EnumMap<EntityType, Integer>(EntityType.class);
|
||||||
if (other.blocksToBreak.equals(blocksToBreak) == false) {
|
Map<DyeColor, Integer> sheepToShear = new EnumMap<DyeColor, Integer>(DyeColor.class);
|
||||||
return false;
|
Map<EnumMap<Material, Integer>, Boolean> itemsToCraft = new HashMap<EnumMap<Material, Integer>, Boolean>();
|
||||||
}
|
String script;
|
||||||
|
Event event;
|
||||||
if (other.blocksToPlace.equals(blocksToPlace) == false) {
|
long delay = -1;
|
||||||
return false;
|
String delayMessage = null;
|
||||||
}
|
|
||||||
|
@Override
|
||||||
if (other.itemsToCollect.equals(itemsToCollect) == false) {
|
public boolean equals(Object o) {
|
||||||
return false;
|
|
||||||
}
|
if (o instanceof Stage) {
|
||||||
|
|
||||||
if (other.blocksToUse.equals(blocksToUse) == false) {
|
Stage other = (Stage) o;
|
||||||
return false;
|
|
||||||
}
|
if (other.blocksToDamage.equals(blocksToDamage) == false) {
|
||||||
|
return false;
|
||||||
if (other.blocksToCut.equals(blocksToCut) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.blocksToBreak.equals(blocksToBreak) == false) {
|
||||||
|
return false;
|
||||||
if (other.fishToCatch != null && fishToCatch != null) {
|
}
|
||||||
if (other.fishToCatch.equals(fishToCatch) == false) {
|
|
||||||
return false;
|
if (other.blocksToPlace.equals(blocksToPlace) == false) {
|
||||||
}
|
return false;
|
||||||
} else if (other.fishToCatch != null && fishToCatch == null) {
|
}
|
||||||
return false;
|
|
||||||
} else if (other.fishToCatch == null && fishToCatch != null) {
|
if (other.blocksToUse.equals(blocksToUse) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (other.playersToKill != null && playersToKill != null) {
|
if (other.blocksToCut.equals(blocksToCut) == false) {
|
||||||
if (other.playersToKill.equals(playersToKill) == false) {
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
} else if (other.playersToKill != null && playersToKill == null) {
|
if (other.fishToCatch != null && fishToCatch != null) {
|
||||||
return false;
|
if (other.fishToCatch.equals(fishToCatch) == false) {
|
||||||
} else if (other.playersToKill == null && playersToKill != null) {
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
} else if (other.fishToCatch != null && fishToCatch == null) {
|
||||||
|
return false;
|
||||||
if (other.itemsToEnchant.equals(itemsToEnchant) == false) {
|
} else if (other.fishToCatch == null && fishToCatch != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (other.mobsToKill.equals(mobsToKill) == false) {
|
if (other.playersToKill != null && playersToKill != null) {
|
||||||
return false;
|
if (other.playersToKill.equals(playersToKill) == false) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
if (other.mobNumToKill.equals(mobNumToKill) == false) {
|
} else if (other.playersToKill != null && playersToKill == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (other.playersToKill == null && playersToKill != null) {
|
||||||
|
return false;
|
||||||
if (other.locationsToKillWithin.equals(locationsToKillWithin) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.itemsToEnchant.equals(itemsToEnchant) == false) {
|
||||||
|
return false;
|
||||||
if (other.radiiToKillWithin.equals(radiiToKillWithin) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.mobsToKill.equals(mobsToKill) == false) {
|
||||||
|
return false;
|
||||||
if (other.areaNames.equals(areaNames) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.mobNumToKill.equals(mobNumToKill) == false) {
|
||||||
|
return false;
|
||||||
if (other.citizensToInteract.equals(citizensToInteract) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.locationsToKillWithin.equals(locationsToKillWithin) == false) {
|
||||||
|
return false;
|
||||||
if (other.citizensToKill.equals(citizensToKill) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.radiiToKillWithin.equals(radiiToKillWithin) == false) {
|
||||||
|
return false;
|
||||||
if (other.citizenNumToKill.equals(citizenNumToKill) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.areaNames.equals(areaNames) == false) {
|
||||||
|
return false;
|
||||||
if (other.locationsToReach.equals(locationsToReach) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.itemsToDeliver.equals(itemsToDeliver) == false){
|
||||||
|
return false;
|
||||||
if (other.radiiToReachWithin.equals(radiiToReachWithin) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.itemAmountsToDeliver.equals(itemAmountsToDeliver) == false){
|
||||||
|
return false;
|
||||||
if (other.worldsToReachWithin.equals(worldsToReachWithin) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.itemDeliveryTargets.equals(itemDeliveryTargets) == false){
|
||||||
|
return false;
|
||||||
if (other.locationNames.equals(locationNames) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.deliverMessages.equals(deliverMessages) == false){
|
||||||
|
return false;
|
||||||
if (other.mobsToTame.equals(mobsToTame) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.citizensToInteract.equals(citizensToInteract) == false) {
|
||||||
|
return false;
|
||||||
if (other.sheepToShear.equals(sheepToShear) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.citizensToKill.equals(citizensToKill) == false) {
|
||||||
|
return false;
|
||||||
if (other.itemsToCraft.equals(itemsToCraft) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.citizenNumToKill.equals(citizenNumToKill) == false) {
|
||||||
|
return false;
|
||||||
if (other.script != null && script != null) {
|
}
|
||||||
if (other.script.equals(script) == false) {
|
|
||||||
return false;
|
if (other.locationsToReach.equals(locationsToReach) == false) {
|
||||||
}
|
return false;
|
||||||
} else if (other.script != null && script == null) {
|
}
|
||||||
return false;
|
|
||||||
} else if (other.script == null && script != null) {
|
if (other.radiiToReachWithin.equals(radiiToReachWithin) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (other.event != null && event != null) {
|
if (other.worldsToReachWithin.equals(worldsToReachWithin) == false) {
|
||||||
if (other.event.equals(event) == false) {
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
} else if (other.event != null && event == null) {
|
if (other.locationNames.equals(locationNames) == false) {
|
||||||
return false;
|
return false;
|
||||||
} else if (other.event == null && event != null) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.mobsToTame.equals(mobsToTame) == false) {
|
||||||
|
return false;
|
||||||
if(other.delay != delay)
|
}
|
||||||
return false;
|
|
||||||
|
if (other.sheepToShear.equals(sheepToShear) == false) {
|
||||||
if (other.delayMessage != null && delayMessage != null) {
|
return false;
|
||||||
if (other.delayMessage.equals(delayMessage) == false) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (other.itemsToCraft.equals(itemsToCraft) == false) {
|
||||||
} else if (other.delayMessage != null && delayMessage == null) {
|
return false;
|
||||||
return false;
|
}
|
||||||
} else if (other.delayMessage == null && delayMessage != null) {
|
|
||||||
return false;
|
if (other.script != null && script != null) {
|
||||||
}
|
if (other.script.equals(script) == false) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (other.script != null && script == null) {
|
||||||
return true;
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,66 +1,65 @@
|
|||||||
package me.blackvein.quests;
|
package me.blackvein.quests;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class StageTimer implements Runnable{
|
public class StageTimer implements Runnable{
|
||||||
|
|
||||||
Quester quester;
|
Quester quester;
|
||||||
Quests plugin;
|
Quests plugin;
|
||||||
|
|
||||||
public StageTimer(Quests quests, Quester q){
|
public StageTimer(Quests quests, Quester q){
|
||||||
|
|
||||||
quester = q;
|
quester = q;
|
||||||
plugin = quests;
|
plugin = quests;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(){
|
public void run(){
|
||||||
|
|
||||||
if(quester.delayOver){
|
if(quester.delayOver){
|
||||||
|
|
||||||
Player player = plugin.getServer().getPlayerExact(quester.name);
|
Player player = plugin.getServer().getPlayerExact(quester.name);
|
||||||
|
|
||||||
if(quester.currentQuest != null){
|
if(quester.currentQuest != null){
|
||||||
|
|
||||||
if(quester.currentQuest.stages.indexOf(quester.currentStage) == (quester.currentQuest.stages.size() - 1)){
|
if(quester.currentQuest.stages.indexOf(quester.currentStage) == (quester.currentQuest.stages.size() - 1)){
|
||||||
|
|
||||||
if(quester.currentStage.script != null)
|
if(quester.currentStage.script != null)
|
||||||
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
||||||
if(quester.currentStage.event != null)
|
if(quester.currentStage.event != null)
|
||||||
quester.currentStage.event.happen(player);
|
quester.currentStage.event.happen(quester);
|
||||||
|
|
||||||
quester.currentQuest.completeQuest(quester);
|
quester.currentQuest.completeQuest(quester);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
quester.reset();
|
quester.reset();
|
||||||
player.sendMessage(plugin.parseString(quester.currentStage.finished, quester.currentQuest));
|
if(quester.currentStage.script != null)
|
||||||
if(quester.currentStage.script != null)
|
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
||||||
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
if(quester.currentStage.event != null)
|
||||||
if(quester.currentStage.event != null)
|
quester.currentStage.event.happen(quester);
|
||||||
quester.currentStage.event.happen(player);
|
quester.currentStage = quester.currentQuest.stages.get(quester.currentQuest.stages.indexOf(quester.currentStage) + 1);
|
||||||
quester.currentStage = quester.currentQuest.stages.get(quester.currentQuest.stages.indexOf(quester.currentStage) + 1);
|
quester.addEmpties();
|
||||||
quester.addEmpties();
|
quester.delayStartTime = 0;
|
||||||
quester.delayStartTime = 0;
|
quester.delayTimeLeft = -1;
|
||||||
quester.delayTimeLeft = -1;
|
|
||||||
|
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
|
||||||
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
|
for(String s : quester.getObjectives()){
|
||||||
for(String s : quester.getObjectives()){
|
|
||||||
|
player.sendMessage(s);
|
||||||
player.sendMessage(s);
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
quester.delayOver = true;
|
||||||
quester.delayOver = true;
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
0
src/me/blackvein/quests/TODO
Normal file
0
src/me/blackvein/quests/TODO
Normal file
3444
src/me/blackvein/quests/prompts/CreateStagePrompt.java
Normal file
3444
src/me/blackvein/quests/prompts/CreateStagePrompt.java
Normal file
File diff suppressed because it is too large
Load Diff
610
src/me/blackvein/quests/prompts/RequirementsPrompt.java
Normal file
610
src/me/blackvein/quests/prompts/RequirementsPrompt.java
Normal 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
715
src/me/blackvein/quests/prompts/RewardsPrompt.java
Normal file
715
src/me/blackvein/quests/prompts/RewardsPrompt.java
Normal 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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
245
src/me/blackvein/quests/prompts/StagesPrompt.java
Normal file
245
src/me/blackvein/quests/prompts/StagesPrompt.java
Normal 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
52
src/me/blackvein/quests/stageDataNames.txt
Normal file
52
src/me/blackvein/quests/stageDataNames.txt
Normal 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
|
146
src/plugin.yml
146
src/plugin.yml
@ -1,71 +1,77 @@
|
|||||||
name: Quests
|
name: Quests
|
||||||
main: me.blackvein.quests.Quests
|
main: me.blackvein.quests.Quests
|
||||||
version: 1.5.1c
|
version: 1.5.4
|
||||||
description: Player questing system
|
description: Player questing system
|
||||||
website: http://dev.bukkit.org/server-mods/quests/
|
website: http://dev.bukkit.org/server-mods/quests/
|
||||||
dev-url: https://github.com/Blackvein/Quests/
|
dev-url: https://github.com/Blackvein/Quests/
|
||||||
authors: [Blackvein]
|
authors: [Blackvein]
|
||||||
soft-depend: [Citizens, Vault]
|
soft-depend: [Citizens, Vault]
|
||||||
permissions:
|
permissions:
|
||||||
quests.quest:
|
quests.quest:
|
||||||
description: View current Quest objectives
|
description: View current Quest objectives
|
||||||
default: true
|
default: true
|
||||||
quests.questinfo:
|
quests.questinfo:
|
||||||
description: View information about a Quest
|
description: View information about a Quest
|
||||||
default: true
|
default: true
|
||||||
quests.quests:
|
quests.quests:
|
||||||
description: View Quests help
|
description: View Quests help
|
||||||
default: true
|
default: true
|
||||||
quests.list:
|
quests.list:
|
||||||
description: List Quests
|
description: List Quests
|
||||||
default: true
|
default: true
|
||||||
quests.take:
|
quests.take:
|
||||||
description: Accept a Quest via command
|
description: Accept a Quest via command
|
||||||
default: true
|
default: true
|
||||||
quests.quit:
|
quests.quit:
|
||||||
description: Quit current Quest
|
description: Quit current Quest
|
||||||
default: true
|
default: true
|
||||||
quests.stats:
|
quests.stats:
|
||||||
description: View Questing statistics
|
description: View Questing statistics
|
||||||
default: true
|
default: true
|
||||||
quests.top:
|
quests.top:
|
||||||
description: View Questing leaderboards
|
description: View Questing leaderboards
|
||||||
default: true
|
default: true
|
||||||
quests.info:
|
quests.info:
|
||||||
description: View plugin information
|
description: View plugin information
|
||||||
default: true
|
default: true
|
||||||
quests.admin:
|
quests.admin:
|
||||||
description: Base Questsadmin command
|
description: Base Questsadmin command
|
||||||
default: op
|
default: op
|
||||||
quests.admin.give:
|
quests.admin.give:
|
||||||
description: Force a player to take a Quest (Overrides requirements)
|
description: Force a player to take a Quest (Overrides requirements)
|
||||||
default: op
|
default: op
|
||||||
quests.admin.quit:
|
quests.admin.quit:
|
||||||
description: Force a player to quit their current Quest
|
description: Force a player to quit their current Quest
|
||||||
default: op
|
default: op
|
||||||
quests.admin.points:
|
quests.admin.points:
|
||||||
description: Set a players Quest Points
|
description: Set a players Quest Points
|
||||||
default: op
|
default: op
|
||||||
quests.admin.finish:
|
quests.admin.finish:
|
||||||
description: Immediately force Quest completion for a player
|
description: Immediately force Quest completion for a player
|
||||||
default: op
|
default: op
|
||||||
quests.admin.nextstage:
|
quests.admin.nextstage:
|
||||||
description: Immediately force Stage completion for a player
|
description: Immediately force Stage completion for a player
|
||||||
default: op
|
default: op
|
||||||
quests.admin.reload:
|
quests.admin.reload:
|
||||||
description: Reload all Quests
|
description: Reload all Quests
|
||||||
default: op
|
default: op
|
||||||
commands:
|
quests.editor.create:
|
||||||
quests:
|
description: Create new Quests
|
||||||
description: Quests command
|
default: op
|
||||||
permission: quests.quests
|
quests.editor.events:
|
||||||
questadmin:
|
description: Create/Edit/Delete Events
|
||||||
description: Quests admin command
|
default: op
|
||||||
permission: quests.admin
|
commands:
|
||||||
aliases: [questsadmin]
|
quests:
|
||||||
quest:
|
description: Quests command
|
||||||
description: Quest command
|
permission: quests.quests
|
||||||
permission: quests.quest
|
questadmin:
|
||||||
editor:
|
description: Quests admin command
|
||||||
description: Editor
|
permission: quests.admin
|
||||||
|
aliases: [questsadmin]
|
||||||
|
quest:
|
||||||
|
description: Quest command
|
||||||
|
permission: quests.quest
|
||||||
|
events:
|
||||||
|
description: Events
|
||||||
permission: quests.editor
|
permission: quests.editor
|
109
src/quests.yml
109
src/quests.yml
@ -1,53 +1,58 @@
|
|||||||
quests:
|
quests:
|
||||||
Miner:
|
Miner:
|
||||||
name: 'Stone 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>.'
|
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.'
|
finish-message: '<yellow>Well done. Here is your reward.'
|
||||||
requirements:
|
redo-delay: 1800000
|
||||||
item-ids: [270]
|
requirements:
|
||||||
item-amounts: [1]
|
item-ids:
|
||||||
remove-items: [false]
|
- 270
|
||||||
fail-requirement-message: '<red>You must have a <purple>Wooden Pickaxe<red> first.'
|
item-amounts:
|
||||||
stages:
|
- 1
|
||||||
ordered:
|
remove-items:
|
||||||
1:
|
- false
|
||||||
break-block-ids: [1]
|
fail-requirement-message: '<red>You must have a <purple>Wooden Pickaxe<red> first.'
|
||||||
break-block-amounts: [10]
|
stages:
|
||||||
|
ordered:
|
||||||
collect-item-ids: [4]
|
1:
|
||||||
collect-item-amounts: [10]
|
break-block-ids:
|
||||||
quest-items: [true]
|
- 1
|
||||||
|
break-block-amounts:
|
||||||
rewards:
|
- 10
|
||||||
money: 1000
|
|
||||||
quest-points: 1
|
rewards:
|
||||||
|
money: 1000
|
||||||
|
quest-points: 1
|
||||||
Hunter:
|
|
||||||
name: 'Mob Hunter'
|
|
||||||
ask-message: '<yellow>Kill an assortment of Mobs.'
|
Hunter:
|
||||||
finish-message: '<yellow>Excellent. Here is a <purple>Diamond Sword<yellow>.'
|
name: 'Mob Hunter'
|
||||||
requirements:
|
ask-message: '<yellow>Kill an assortment of Mobs.'
|
||||||
quests: [Stone Miner]
|
finish-message: '<yellow>Excellent. Here is a <purple>Diamond Sword<yellow>.'
|
||||||
fail-requirement-message: '<red>Complete <purple>Stone Miner<red> first.'
|
requirements:
|
||||||
stages:
|
quests:
|
||||||
ordered:
|
- Stone Miner
|
||||||
1:
|
fail-requirement-message: '<red>Complete <purple>Stone Miner<red> first.'
|
||||||
mobs-to-kill: [Pig]
|
stages:
|
||||||
mob-amounts: [3]
|
ordered:
|
||||||
|
1:
|
||||||
finished: '<yellow>Now kill <purple>2 Zombies<yellow>.'
|
mobs-to-kill:
|
||||||
2:
|
- Pig
|
||||||
mobs-to-kill: [Zombie]
|
mob-amounts:
|
||||||
mob-amounts: [2]
|
- 3
|
||||||
|
2:
|
||||||
finished: '<yellow>Finally, kill <purple>1 Skeleton<yellow>.'
|
mobs-to-kill:
|
||||||
3:
|
- Zombie
|
||||||
mobs-to-kill: [Skeleton]
|
mob-amounts:
|
||||||
mob-amounts: [1]
|
- 2
|
||||||
|
3:
|
||||||
rewards:
|
mobs-to-kill:
|
||||||
item-ids: [276]
|
- Skeleton
|
||||||
item-amounts: [1]
|
mob-amounts:
|
||||||
exp: 100
|
- 1
|
||||||
|
|
||||||
|
rewards:
|
||||||
|
item-ids: [276]
|
||||||
|
item-amounts: [1]
|
||||||
|
exp: 100
|
||||||
quest-points: 1
|
quest-points: 1
|
Loading…
Reference in New Issue
Block a user