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
@ -24,6 +24,7 @@ show-requirements: true
|
||||
allow-quitting: true
|
||||
debug-mode: false
|
||||
kill-delay: 600
|
||||
snoop: true
|
||||
quester-blacklist:
|
||||
- "SomeGuy12345"
|
||||
- "somePrefix*"
|
||||
|
@ -31,9 +31,9 @@ public class Event {
|
||||
LinkedList<Location> lightningStrikes = new LinkedList<Location>();
|
||||
|
||||
LinkedList<PotionEffect> potionEffects = new LinkedList<PotionEffect>();
|
||||
int hunger = 0;
|
||||
int saturation = 0;
|
||||
int health = 0;
|
||||
int hunger = -1;
|
||||
int saturation = -1;
|
||||
int health = -1;
|
||||
Location teleport;
|
||||
|
||||
@Override
|
||||
@ -125,10 +125,18 @@ public class Event {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void happen(Player player){
|
||||
public String getName(){
|
||||
|
||||
return name;
|
||||
|
||||
}
|
||||
|
||||
public void happen(Quester quester){
|
||||
|
||||
Player player = quester.getPlayer();
|
||||
|
||||
if(message != null)
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(Quests.parseString(message, quester.currentQuest));
|
||||
|
||||
if(clearInv == true){
|
||||
player.getInventory().clear();
|
||||
@ -205,19 +213,19 @@ public class Event {
|
||||
|
||||
}
|
||||
|
||||
if(hunger != 0){
|
||||
if(hunger != -1){
|
||||
|
||||
player.setFoodLevel(hunger);
|
||||
|
||||
}
|
||||
|
||||
if(saturation != 0){
|
||||
if(saturation != -1){
|
||||
|
||||
player.setSaturation(saturation);
|
||||
|
||||
}
|
||||
|
||||
if(health != 0){
|
||||
if(health != -1){
|
||||
|
||||
player.setHealth(health);
|
||||
|
||||
@ -231,9 +239,9 @@ public class Event {
|
||||
|
||||
}
|
||||
|
||||
public static Event getEvent(String name, Quests plugin, Quest quest){
|
||||
public static Event getEvent(String name, Quests plugin){
|
||||
|
||||
if(name == null || plugin == null || quest == null)
|
||||
if(name == null || plugin == null)
|
||||
return null;
|
||||
|
||||
Event event = new Event();
|
||||
@ -249,7 +257,7 @@ public class Event {
|
||||
|
||||
event.name = name;
|
||||
if(data.contains(eventKey + "message"))
|
||||
event.message = plugin.parseString(data.getString(eventKey + "message"), quest);
|
||||
event.message = data.getString(eventKey + "message");
|
||||
|
||||
if(data.contains(eventKey + "clear-inventory")){
|
||||
|
||||
|
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
@ -2,12 +2,14 @@ package me.blackvein.quests;
|
||||
|
||||
import net.citizensnpcs.api.event.NPCDespawnEvent;
|
||||
import net.citizensnpcs.api.event.NPCRightClickEvent;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.Conversable;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NpcListener implements Listener {
|
||||
|
||||
@ -22,20 +24,39 @@ public class NpcListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onNPCRightClick(NPCRightClickEvent evt) {
|
||||
|
||||
if (plugin.questNPCs.contains(evt.getNPC())) {
|
||||
|
||||
final Player player = evt.getClicker();
|
||||
final Quester quester = plugin.getQuester(player.getName());
|
||||
boolean delivery = false;
|
||||
|
||||
if(quester.hasObjective("deliverItem") && player.getItemInHand() != null){
|
||||
|
||||
ItemStack hand = player.getItemInHand();
|
||||
if(quester.itemsDelivered.containsKey(hand.getType())){
|
||||
|
||||
NPC clicked = evt.getNPC();
|
||||
|
||||
for(NPC n : quester.currentStage.itemDeliveryTargets){
|
||||
if(n.getId() == clicked.getId()){
|
||||
quester.deliverItem(hand);
|
||||
delivery = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (plugin.questNPCs.contains(evt.getNPC()) && delivery == false) {
|
||||
|
||||
if (plugin.checkQuester(player.getName()) == false) {
|
||||
|
||||
final Quester quester = plugin.getQuester(player.getName());
|
||||
if (quester.hasObjective("talkToNPC")) {
|
||||
|
||||
quester.interactWithNPC(evt.getNPC());
|
||||
|
||||
} else {
|
||||
|
||||
for (final Quest q : plugin.quests) {
|
||||
for (Quest q : plugin.quests) {
|
||||
|
||||
if (q.npcStart != null && player.hasPermission("quests.quest")) {
|
||||
|
||||
@ -66,17 +87,19 @@ public class NpcListener implements Listener {
|
||||
|
||||
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();
|
||||
|
||||
player.sendMessage(s);
|
||||
|
||||
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||
}
|
||||
|
||||
} else if (quester.currentQuest.equals(q) == false) {
|
||||
|
@ -1,9 +1,10 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.conversations.Conversable;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.*;
|
||||
@ -19,14 +20,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityTameEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.CraftItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerFishEvent.State;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.event.player.PlayerFishEvent.State;
|
||||
|
||||
public class PlayerListener implements Listener {
|
||||
|
||||
@ -52,6 +47,62 @@ public class PlayerListener implements Listener {
|
||||
|
||||
quester.useBlock(evt.getClickedBlock().getType());
|
||||
|
||||
}else if (plugin.questFactory.selectedBlockStarts.containsKey(evt.getPlayer())){
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.questFactory.selectedBlockStarts.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
}else if (plugin.eventFactory.selectedExplosionLocations.containsKey(evt.getPlayer())){
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedExplosionLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
}else if (plugin.eventFactory.selectedEffectLocations.containsKey(evt.getPlayer())){
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedEffectLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
}else if (plugin.eventFactory.selectedMobLocations.containsKey(evt.getPlayer())){
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedMobLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
}else if (plugin.eventFactory.selectedLightningLocations.containsKey(evt.getPlayer())){
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedLightningLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
}else if (plugin.eventFactory.selectedTeleportLocations.containsKey(evt.getPlayer())){
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedTeleportLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
}else if (plugin.questFactory.selectedKillLocations.containsKey(evt.getPlayer())){
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.questFactory.selectedKillLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
}else if (plugin.questFactory.selectedReachLocations.containsKey(evt.getPlayer())){
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.questFactory.selectedReachLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
}else {
|
||||
|
||||
for (final Quest q : plugin.quests) {
|
||||
@ -68,11 +119,16 @@ public class PlayerListener implements Listener {
|
||||
|
||||
if (quester.completedQuests.contains(q.name)) {
|
||||
|
||||
if (q.redoDelay < 0 || q.redoDelay > -1 && (quester.getDifference(q)) > 0) {
|
||||
if (q.redoDelay > -1 && (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 + ".");
|
||||
return;
|
||||
|
||||
}else if (quester.completedQuests.contains(q.name) && q.redoDelay < 0) {
|
||||
|
||||
player.sendMessage(ChatColor.YELLOW + "You have already completed " + ChatColor.AQUA + q.name + ChatColor.YELLOW + ".");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -184,22 +240,6 @@ public class PlayerListener implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent evt) {
|
||||
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||
if (quester.hasObjective("collectItem")) {
|
||||
|
||||
quester.collectItem(evt.getItem().getItemStack());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerShearEntity(PlayerShearEntityEvent evt) {
|
||||
|
||||
@ -258,37 +298,6 @@ public class PlayerListener implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCraftItem(final CraftItemEvent evt) {
|
||||
|
||||
if (evt.getWhoClicked() instanceof Player) {
|
||||
|
||||
Player p = (Player) evt.getWhoClicked();
|
||||
if (plugin.checkQuester(p.getName()) == false) {
|
||||
|
||||
final Quester quester = plugin.getQuester(p.getName());
|
||||
//HANDLE CRAFTING ITEMS FOR ITEM CRAFTING AND COLLECTION
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent evt) {
|
||||
|
||||
if (evt.getPlayer() instanceof Player) {
|
||||
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
//HANDLE CLOSING INVENTORY
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
*
|
||||
* CRAFTING (Player)
|
||||
@ -360,25 +369,6 @@ public class PlayerListener implements Listener {
|
||||
*
|
||||
*/
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onInventoryClick(InventoryClickEvent evt) {
|
||||
Player player = null;
|
||||
if (evt.getWhoClicked() instanceof Player) {
|
||||
player = (Player) evt.getWhoClicked();
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
|
||||
if (plugin.checkQuester(player.getName()) == false) {
|
||||
|
||||
//HANDLE INVENTORY CLICKING FOR ITEM COLLECTION
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDeath(EntityDeathEvent evt) {
|
||||
|
||||
@ -532,27 +522,6 @@ public class PlayerListener implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent evt) {
|
||||
|
||||
if(plugin.checkQuester(evt.getPlayer().getName()) == false){
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||
if (quester.currentQuest != null) {
|
||||
|
||||
if (quester.currentQuest.questItems.containsKey(evt.getItemDrop().getItemStack().getType())) {
|
||||
|
||||
evt.getPlayer().sendMessage(ChatColor.YELLOW + "You may not discard Quest items.");
|
||||
evt.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent evt) {
|
||||
|
||||
@ -602,9 +571,12 @@ public class PlayerListener implements Listener {
|
||||
if(plugin.checkQuester(evt.getPlayer().getName()) == false){
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||
if(quester.currentQuest != null){
|
||||
if(quester.currentStage.delay > -1)
|
||||
quester.stopStageTimer();
|
||||
}
|
||||
quester.saveData();
|
||||
|
||||
plugin.questers.remove(quester.name);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import com.herocraftonline.heroes.characters.classes.HeroClass.ExperienceType;
|
||||
import java.util.EnumMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -49,16 +48,12 @@ public class Quest {
|
||||
List<String> permissions = new LinkedList<String>();
|
||||
LinkedList<ItemStack> itemRewards = new LinkedList<ItemStack>();
|
||||
LinkedList<Integer> itemRewardAmounts = new LinkedList<Integer>();
|
||||
//Heroes
|
||||
int heroesExp = 0;
|
||||
String heroesClass = null;
|
||||
String heroesSecClass = null;
|
||||
//
|
||||
|
||||
//mcMMO
|
||||
List<String> mcmmoSkills = new LinkedList<String>();
|
||||
List<Integer> mcmmoAmounts = new LinkedList<Integer>();
|
||||
//
|
||||
|
||||
//
|
||||
public void nextStage(Quester q){
|
||||
|
||||
@ -71,36 +66,20 @@ public class Quest {
|
||||
if(q.currentStage.script != null)
|
||||
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
|
||||
if(q.currentStage.event != null)
|
||||
q.currentStage.event.happen(player);
|
||||
q.currentStage.event.happen(q);
|
||||
|
||||
completeQuest(q);
|
||||
|
||||
}else {
|
||||
|
||||
q.reset();
|
||||
player.sendMessage(plugin.parseString(q.currentStage.finished, q.currentQuest));
|
||||
if(q.currentStage.script != null)
|
||||
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
|
||||
if(q.currentStage.event != null)
|
||||
q.currentStage.event.happen(player);
|
||||
q.currentStage.event.happen(q);
|
||||
q.currentStage = stages.get(stages.indexOf(q.currentStage) + 1);
|
||||
q.addEmpties();
|
||||
|
||||
for (Entry e : q.currentStage.itemsToCollect.entrySet()) {
|
||||
|
||||
if ((Boolean) e.getValue() == true) {
|
||||
|
||||
Map<Material, Integer> tempMap = (Map<Material, Integer>) e.getKey();
|
||||
for (Entry e2 : tempMap.entrySet()) {
|
||||
|
||||
questItems.put((Material) e2.getKey(), (Integer) e2.getValue());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Entry e : q.currentStage.itemsToCraft.entrySet()) {
|
||||
|
||||
if ((Boolean) e.getValue() == true) {
|
||||
@ -191,7 +170,7 @@ public class Quest {
|
||||
q.reset();
|
||||
q.completedQuests.add(name);
|
||||
String none = ChatColor.GRAY + "- (None)";
|
||||
player.sendMessage(plugin.parseString(finished, q.currentQuest));
|
||||
player.sendMessage(Quests.parseString(finished, q.currentQuest));
|
||||
if(moneyReward > 0 && Quests.economy != null){
|
||||
Quests.economy.depositPlayer(q.name, moneyReward);
|
||||
none = null;
|
||||
@ -264,20 +243,6 @@ public class Quest {
|
||||
none = null;
|
||||
}
|
||||
|
||||
if(heroesExp > 0){
|
||||
plugin.heroes.getCharacterManager().getHero(player).gainExp(heroesExp, ExperienceType.QUESTING, player.getLocation());
|
||||
none = null;
|
||||
}
|
||||
|
||||
if(heroesClass != null){
|
||||
plugin.heroes.getCharacterManager().getHero(player).changeHeroClass(plugin.heroes.getClassManager().getClass(heroesClass), false);
|
||||
none = null;
|
||||
}
|
||||
|
||||
if(heroesSecClass != null){
|
||||
plugin.heroes.getCharacterManager().getHero(player).changeHeroClass(plugin.heroes.getClassManager().getClass(heroesSecClass), true);
|
||||
none = null;
|
||||
}
|
||||
player.sendMessage(ChatColor.GOLD + "**QUEST COMPLETE: " + ChatColor.YELLOW + q.currentQuest.name + ChatColor.GOLD + "**");
|
||||
player.sendMessage(ChatColor.GREEN + "Rewards:");
|
||||
|
||||
@ -305,21 +270,6 @@ public class Quest {
|
||||
none = null;
|
||||
}
|
||||
|
||||
if(heroesExp > 0){
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + heroesExp + ChatColor.DARK_PURPLE + " Heroes Exp");
|
||||
none = null;
|
||||
}
|
||||
|
||||
if(heroesClass != null){
|
||||
player.sendMessage("- " + ChatColor.DARK_PURPLE + heroesClass + ChatColor.AQUA + " Heroes Class");
|
||||
none = null;
|
||||
}
|
||||
|
||||
if(heroesSecClass != null){
|
||||
player.sendMessage("- " + ChatColor.DARK_PURPLE + heroesSecClass + ChatColor.AQUA + " Heroes Secondary Class");
|
||||
none = null;
|
||||
}
|
||||
|
||||
if(none != null){
|
||||
player.sendMessage(none);
|
||||
}
|
||||
@ -370,25 +320,6 @@ public class Quest {
|
||||
if(other.finished.equals(finished) == false)
|
||||
return false;
|
||||
|
||||
if(other.heroesClass != null && heroesClass != null){
|
||||
if(other.heroesClass.equals(heroesClass) == false)
|
||||
return false;
|
||||
}else if(other.heroesClass != null && heroesClass == null){
|
||||
return false;
|
||||
}else if(other.heroesClass == null && heroesClass != null)
|
||||
return false;
|
||||
|
||||
if(other.heroesExp != heroesExp)
|
||||
return false;
|
||||
|
||||
if(other.heroesSecClass != null && heroesSecClass != null){
|
||||
if(other.heroesSecClass.equals(heroesSecClass) == false)
|
||||
return false;
|
||||
}else if(other.heroesSecClass != null && heroesSecClass == null){
|
||||
return false;
|
||||
}else if(other.heroesSecClass == null && heroesSecClass != null)
|
||||
return false;
|
||||
|
||||
if(other.itemAmounts.equals(itemAmounts) == false)
|
||||
return false;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,26 +1,17 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import java.util.List;
|
||||
import net.aufdemrand.denizen.scripts.ScriptEngine.QueueType;
|
||||
import net.aufdemrand.denizen.scripts.ScriptHelper;
|
||||
import net.aufdemrand.denizen.triggers.AbstractTrigger;
|
||||
import net.aufdemrand.denizen.scripts.ScriptRegistry;
|
||||
import net.aufdemrand.denizen.scripts.containers.core.TaskScriptContainer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class QuestTaskTrigger extends AbstractTrigger {
|
||||
public class QuestTaskTrigger {
|
||||
|
||||
public boolean parseQuestTaskTrigger(String theScriptName, Player thePlayer) {
|
||||
|
||||
ScriptHelper sE = plugin.getScriptEngine().helper;
|
||||
|
||||
if (theScriptName == null) return false;
|
||||
|
||||
List<String> theScript = sE.getScript(theScriptName + ".Script");
|
||||
|
||||
if (theScript.isEmpty()) return false;
|
||||
|
||||
sE.queueScriptEntries(thePlayer, sE.buildScriptEntries(thePlayer, theScript, theScriptName), QueueType.TASK);
|
||||
|
||||
if (!ScriptRegistry.containsScript(theScriptName)) {
|
||||
return false;
|
||||
}
|
||||
TaskScriptContainer task_script = ScriptRegistry.getScriptContainerAs(theScriptName, TaskScriptContainer.class);
|
||||
task_script.runTaskScript(thePlayer, null, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
@ -17,7 +17,6 @@ import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
public class Quester {
|
||||
|
||||
@ -35,10 +34,10 @@ public class Quester {
|
||||
Map<Material, Integer> blocksDamaged = new EnumMap<Material, Integer>(Material.class);
|
||||
Map<Material, Integer> blocksBroken = new EnumMap<Material, Integer>(Material.class);
|
||||
Map<Material, Integer> blocksPlaced = new EnumMap<Material, Integer>(Material.class);
|
||||
Map<Material, Integer> itemsCollected = new EnumMap<Material, Integer>(Material.class);
|
||||
Map<Material, Integer> blocksUsed = new EnumMap<Material, Integer>(Material.class);
|
||||
Map<Material, Integer> blocksCut = new EnumMap<Material, Integer>(Material.class);
|
||||
Map<Integer, Integer> potionsBrewed = new HashMap<Integer, Integer>();
|
||||
Map<Material, Integer> itemsDelivered = new EnumMap<Material, Integer>(Material.class);
|
||||
int fishCaught = 0;
|
||||
int playersKilled = 0;
|
||||
long delayStartTime = 0;
|
||||
@ -58,6 +57,7 @@ public class Quester {
|
||||
Map<EntityType, Integer> mobsTamed = new EnumMap<EntityType, Integer>(EntityType.class);
|
||||
Map<DyeColor, Integer> sheepSheared = new EnumMap<DyeColor, Integer>(DyeColor.class);
|
||||
Map<Material, Integer> itemsCrafted = new EnumMap<Material, Integer>(Material.class);
|
||||
final Random random = new Random();
|
||||
|
||||
public Quester(Quests newPlugin) {
|
||||
|
||||
@ -65,6 +65,12 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
|
||||
return plugin.getServer().getPlayer(name);
|
||||
|
||||
}
|
||||
|
||||
public void takeQuest(Quest q) {
|
||||
|
||||
Player player = plugin.getServer().getPlayer(name);
|
||||
@ -171,34 +177,6 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
for (Entry e : currentStage.itemsToCollect.entrySet()) {
|
||||
|
||||
Map<Material, Integer> map = (Map<Material, Integer>) e.getKey();
|
||||
|
||||
for (Entry e2 : map.entrySet()) {
|
||||
|
||||
for (Entry e3 : itemsCollected.entrySet()) {
|
||||
|
||||
if (((Material) e3.getKey()).equals((Material) e2.getKey())) {
|
||||
|
||||
if (((Integer) e3.getValue()) < ((Integer) e2.getValue())) {
|
||||
|
||||
unfinishedObjectives.add(ChatColor.GREEN + "Collect " + Quester.prettyItemString(((Material) e3.getKey()).getId()) + ": " + ((Integer) e3.getValue()) + "/" + ((Integer) e2.getValue()));
|
||||
|
||||
} else {
|
||||
|
||||
finishedObjectives.add(ChatColor.GRAY + "Collect " + Quester.prettyItemString(((Material) e3.getKey()).getId()) + ": " + ((Integer) e3.getValue()) + "/" + ((Integer) e2.getValue()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Entry e : currentStage.blocksToUse.entrySet()) {
|
||||
|
||||
for (Entry e2 : blocksUsed.entrySet()) {
|
||||
@ -358,6 +336,25 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
for (Material m : currentStage.itemsToDeliver) {
|
||||
|
||||
int delivered = itemsDelivered.get(m);
|
||||
int amt = currentStage.itemAmountsToDeliver.get(currentStage.itemsToDeliver.indexOf(m));
|
||||
NPC npc = currentStage.itemDeliveryTargets.get(currentStage.itemsToDeliver.indexOf(m));
|
||||
|
||||
if (delivered < amt) {
|
||||
|
||||
unfinishedObjectives.add(ChatColor.GREEN + "Deliver " + Quester.prettyItemString(m.getId()) + " to " + npc.getName() + ": " + delivered + "/" + amt);
|
||||
|
||||
} else {
|
||||
|
||||
finishedObjectives.add(ChatColor.GRAY + "Deliver " + Quester.prettyItemString(m.getId()) + " to " + npc.getName() + ": " + delivered + "/" + amt);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (NPC n : currentStage.citizensToInteract) {
|
||||
|
||||
for (Entry e : citizensInteracted.entrySet()) {
|
||||
@ -445,8 +442,9 @@ public class Quester {
|
||||
for (Entry e : currentStage.itemsToCraft.entrySet()) {
|
||||
|
||||
Entry entry = null;
|
||||
for(Object o : ((Map) e.getKey()).entrySet())
|
||||
for (Object o : ((Map) e.getKey()).entrySet()) {
|
||||
entry = (Entry) o;
|
||||
}
|
||||
|
||||
for (Entry e2 : itemsCrafted.entrySet()) {
|
||||
|
||||
@ -527,14 +525,6 @@ public class Quester {
|
||||
return true;
|
||||
}
|
||||
|
||||
} else if (s.equalsIgnoreCase("collectItem")) {
|
||||
|
||||
if (currentStage.itemsToCollect.isEmpty()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
} else if (s.equalsIgnoreCase("useBlock")) {
|
||||
|
||||
if (currentStage.blocksToUse.isEmpty()) {
|
||||
@ -575,6 +565,14 @@ public class Quester {
|
||||
return true;
|
||||
}
|
||||
|
||||
} else if (s.equalsIgnoreCase("deliverItem")) {
|
||||
|
||||
if (currentStage.itemsToDeliver.isEmpty()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
} else if (s.equalsIgnoreCase("killPlayer")) {
|
||||
|
||||
if (currentStage.playersToKill == null) {
|
||||
@ -679,38 +677,6 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
public void collectItem(ItemStack i) {
|
||||
|
||||
if (itemsCollected.containsKey(i.getType())) {
|
||||
|
||||
for (Map m : currentStage.itemsToCollect.keySet()) {
|
||||
|
||||
if (m.containsKey(i.getType())) {
|
||||
|
||||
if (itemsCollected.get(i.getType()) < (Integer) m.get(i.getType())) {
|
||||
int integer = itemsCollected.get(i.getType());
|
||||
if ((i.getAmount() + integer) >= (Integer) m.get(i.getType())) {
|
||||
itemsCollected.put(i.getType(), (Integer) m.get(i.getType()));
|
||||
} else {
|
||||
itemsCollected.put(i.getType(), (integer + i.getAmount()));
|
||||
}
|
||||
|
||||
if (itemsCollected.get(i.getType()).equals((Integer) m.get(i.getType()))) {
|
||||
finishObjective("collectItem", null, i, null, null, null, null, null, null, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void useBlock(Material m) {
|
||||
|
||||
if (blocksUsed.containsKey(m)) {
|
||||
@ -896,9 +862,10 @@ public class Quester {
|
||||
int index = citizensKilled.indexOf(n);
|
||||
if (citizenNumKilled.get(index) < currentStage.citizenNumToKill.get(index)) {
|
||||
citizenNumKilled.set(index, citizenNumKilled.get(index) + 1);
|
||||
if(citizenNumKilled.get(index) == currentStage.citizenNumToKill.get(index))
|
||||
if (citizenNumKilled.get(index) == currentStage.citizenNumToKill.get(index)) {
|
||||
finishObjective("killNPC", null, null, null, null, null, n, null, null, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -962,6 +929,49 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
public void deliverItem(ItemStack i) {
|
||||
|
||||
Player player = plugin.getServer().getPlayer(name);
|
||||
|
||||
if (itemsDelivered.containsKey(i.getType())) {
|
||||
|
||||
int amount = itemsDelivered.get(i.getType());
|
||||
int req = currentStage.itemAmountsToDeliver.get(currentStage.itemsToDeliver.indexOf(i.getType()));
|
||||
|
||||
if (amount < req) {
|
||||
|
||||
if ((i.getAmount() + amount) > req) {
|
||||
|
||||
itemsDelivered.put(i.getType(), req);
|
||||
int index = player.getInventory().first(i);
|
||||
i.setAmount(i.getAmount() - (req - amount)); //Take away the remaining amount needed to be delivered from the item stack
|
||||
player.getInventory().setItem(index, i);
|
||||
player.updateInventory();
|
||||
finishObjective("deliverItem", i.getType(), null, null, null, null, null, null, null, 0);
|
||||
|
||||
} else if ((i.getAmount() + amount) == req) {
|
||||
|
||||
itemsDelivered.put(i.getType(), req);
|
||||
player.getInventory().setItem(player.getInventory().first(i), null);
|
||||
player.updateInventory();
|
||||
finishObjective("deliverItem", i.getType(), null, null, null, null, null, null, null, 0);
|
||||
|
||||
} else {
|
||||
|
||||
itemsDelivered.put(i.getType(), (amount + i.getAmount()));
|
||||
player.getInventory().setItem(player.getInventory().first(i), null);
|
||||
player.updateInventory();
|
||||
String message = Quests.parseString(currentStage.deliverMessages.get(random.nextInt(currentStage.deliverMessages.size())), currentQuest);
|
||||
player.sendMessage(message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void craftItem(ItemStack i) {
|
||||
|
||||
if (itemsCrafted.containsKey(i.getType())) {
|
||||
@ -1025,16 +1035,6 @@ public class Quester {
|
||||
currentQuest.nextStage(this);
|
||||
}
|
||||
|
||||
} else if (objective.equalsIgnoreCase("collectItem")) {
|
||||
|
||||
String message = ChatColor.GREEN + "(Completed) Collect " + prettyItemString(itemstack.getTypeId());
|
||||
message = message + " " + itemsCollected.get(itemstack.getType()) + "/" + itemsCollected.get(itemstack.getType());
|
||||
|
||||
p.sendMessage(message);
|
||||
if (testComplete()) {
|
||||
currentQuest.nextStage(this);
|
||||
}
|
||||
|
||||
} else if (objective.equalsIgnoreCase("useBlock")) {
|
||||
|
||||
String message = ChatColor.GREEN + "(Completed) Use " + prettyItemString(material.getId());
|
||||
@ -1081,6 +1081,14 @@ public class Quester {
|
||||
currentQuest.nextStage(this);
|
||||
}
|
||||
|
||||
} else if (objective.equalsIgnoreCase("deliverItem")) {
|
||||
|
||||
String message = ChatColor.GREEN + "(Completed) Deliver " + currentStage.itemAmountsToDeliver.get(currentStage.itemsToDeliver.indexOf(material)) + " " + prettyItemString(material.getId()) + " to " + currentStage.itemDeliveryTargets.get(currentStage.itemsToDeliver.indexOf(material)).getName();
|
||||
p.sendMessage(message);
|
||||
if (testComplete()) {
|
||||
currentQuest.nextStage(this);
|
||||
}
|
||||
|
||||
} else if (objective.equalsIgnoreCase("killMob")) {
|
||||
|
||||
String message = ChatColor.GREEN + "(Completed) Kill " + mob.getName();
|
||||
@ -1134,15 +1142,6 @@ public class Quester {
|
||||
currentQuest.nextStage(this);
|
||||
}
|
||||
|
||||
} else if (objective.equalsIgnoreCase("craftItem")) {
|
||||
|
||||
String message = ChatColor.GREEN + "(Completed) Craft " + prettyItemString(material.getId());
|
||||
message = message + " " + itemsCrafted.get(material) + "/" + itemsCrafted.get(material);
|
||||
p.sendMessage(message);
|
||||
if (testComplete()) {
|
||||
currentQuest.nextStage(this);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
String message = ChatColor.GREEN + "(Completed) Go to " + currentStage.locationNames.get(currentStage.locationsToReach.indexOf(location));
|
||||
@ -1194,18 +1193,6 @@ public class Quester {
|
||||
}
|
||||
}
|
||||
|
||||
if (currentStage.itemsToCollect.isEmpty() == false) {
|
||||
for (Entry e : currentStage.itemsToCollect.entrySet()) {
|
||||
|
||||
for (Object o : ((Map) e.getKey()).keySet()) {
|
||||
|
||||
itemsCollected.put((Material) o, 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (currentStage.blocksToUse.isEmpty() == false) {
|
||||
for (Material m : currentStage.blocksToUse.keySet()) {
|
||||
|
||||
@ -1250,6 +1237,14 @@ public class Quester {
|
||||
|
||||
playersKilled = 0;
|
||||
|
||||
if (currentStage.itemsToDeliver.isEmpty() == false) {
|
||||
for (Material m : currentStage.itemsToDeliver) {
|
||||
|
||||
itemsDelivered.put(m, 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (currentStage.citizensToInteract.isEmpty() == false) {
|
||||
for (NPC n : currentStage.citizensToInteract) {
|
||||
|
||||
@ -1320,7 +1315,6 @@ public class Quester {
|
||||
blocksDamaged.clear();
|
||||
blocksBroken.clear();
|
||||
blocksPlaced.clear();
|
||||
itemsCollected.clear();
|
||||
blocksUsed.clear();
|
||||
blocksCut.clear();
|
||||
fishCaught = 0;
|
||||
@ -1330,6 +1324,7 @@ public class Quester {
|
||||
locationsToKillWithin.clear();
|
||||
radiiToKillWithin.clear();
|
||||
playersKilled = 0;
|
||||
itemsDelivered.clear();
|
||||
citizensInteracted.clear();
|
||||
citizensKilled.clear();
|
||||
citizenNumKilled.clear();
|
||||
@ -1369,32 +1364,6 @@ public class Quester {
|
||||
return prettyString;
|
||||
}
|
||||
|
||||
public static String prettyPotionString(PotionType type) {
|
||||
|
||||
if (type.equals(PotionType.FIRE_RESISTANCE)) {
|
||||
return "Fire Resistance";
|
||||
} else if (type.equals(PotionType.INSTANT_DAMAGE)) {
|
||||
return "Harming";
|
||||
} else if (type.equals(PotionType.INSTANT_HEAL)) {
|
||||
return "Healing";
|
||||
} else if (type.equals(PotionType.POISON)) {
|
||||
return "Poison";
|
||||
} else if (type.equals(PotionType.REGEN)) {
|
||||
return "Regeneration";
|
||||
} else if (type.equals(PotionType.SLOWNESS)) {
|
||||
return "Slowness";
|
||||
} else if (type.equals(PotionType.SPEED)) {
|
||||
return "Swiftness";
|
||||
} else if (type.equals(PotionType.STRENGTH)) {
|
||||
return "Strength";
|
||||
} else if (type.equals(PotionType.WATER)) {
|
||||
return "Water";
|
||||
} else {
|
||||
return "Weakness";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String fullPotionString(short dv) {
|
||||
|
||||
Potion potion = Potion.fromDamage(dv);
|
||||
@ -1403,7 +1372,7 @@ public class Quester {
|
||||
|
||||
try {
|
||||
|
||||
potionName = "Potion of " + Quester.prettyPotionString(potion.getType());
|
||||
potionName = "Potion of " + potion.getType().getEffectType().getName();
|
||||
|
||||
} catch (NullPointerException e) { // Potion is primary
|
||||
|
||||
@ -1443,7 +1412,7 @@ public class Quester {
|
||||
|
||||
public static String prettyMobString(EntityType type) {
|
||||
|
||||
String baseString = type.getName();
|
||||
String baseString = type.toString();
|
||||
String[] substrings = baseString.split("_");
|
||||
String prettyString = "";
|
||||
int size = 1;
|
||||
@ -1465,6 +1434,26 @@ public class Quester {
|
||||
return prettyString;
|
||||
}
|
||||
|
||||
public static String prettyString(String s) {
|
||||
|
||||
String[] substrings = s.split("_");
|
||||
String prettyString = "";
|
||||
int size = 1;
|
||||
|
||||
for (String sb : substrings) {
|
||||
prettyString = prettyString.concat(Quester.getCapitalized(sb));
|
||||
|
||||
if (size < substrings.length) {
|
||||
prettyString = prettyString.concat(" ");
|
||||
}
|
||||
|
||||
size++;
|
||||
}
|
||||
|
||||
return prettyString;
|
||||
|
||||
}
|
||||
|
||||
public static String prettyEnchantmentString(Enchantment e) {
|
||||
|
||||
String prettyString = "";
|
||||
@ -1509,6 +1498,8 @@ public class Quester {
|
||||
prettyString = "Projectile Protection";
|
||||
} else if (e.equals(Enchantment.SILK_TOUCH)) {
|
||||
prettyString = "Silk Touch";
|
||||
} else if (e.equals(Enchantment.THORNS)) {
|
||||
prettyString = "Thorns";
|
||||
} else if (e.equals(Enchantment.WATER_WORKER)) {
|
||||
prettyString = "Aqua Affinity";
|
||||
}
|
||||
@ -1656,21 +1647,6 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
if (itemsCollected.isEmpty() == false) {
|
||||
|
||||
LinkedList<Integer> itemIds = new LinkedList<Integer>();
|
||||
LinkedList<Integer> itemAmounts = new LinkedList<Integer>();
|
||||
|
||||
for (Material m : itemsCollected.keySet()) {
|
||||
itemIds.add(m.getId());
|
||||
itemAmounts.add(itemsCollected.get(m));
|
||||
}
|
||||
|
||||
data.set("items-collected-ids", itemIds);
|
||||
data.set("items-collected-amounts", itemAmounts);
|
||||
|
||||
}
|
||||
|
||||
if (blocksUsed.isEmpty() == false) {
|
||||
|
||||
LinkedList<Integer> blockIds = new LinkedList<Integer>();
|
||||
@ -1778,6 +1754,23 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
if (itemsDelivered.isEmpty() == false) {
|
||||
|
||||
LinkedList<Integer> deliveryIds = new LinkedList<Integer>();
|
||||
LinkedList<Integer> deliveryAmounts = new LinkedList<Integer>();
|
||||
|
||||
for (Entry<Material, Integer> e : itemsDelivered.entrySet()) {
|
||||
|
||||
deliveryIds.add(e.getKey().getId());
|
||||
deliveryAmounts.add(e.getValue());
|
||||
|
||||
}
|
||||
|
||||
data.set("item-delivery-ids", deliveryIds);
|
||||
data.set("item-delivery-amounts", deliveryAmounts);
|
||||
|
||||
}
|
||||
|
||||
if (citizensInteracted.isEmpty() == false) {
|
||||
|
||||
LinkedList<Integer> npcIds = new LinkedList<Integer>();
|
||||
@ -1904,8 +1897,9 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
if(delayTimeLeft > 0)
|
||||
if (delayTimeLeft > 0) {
|
||||
data.set("stage-delay", delayTimeLeft);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
@ -2060,19 +2054,6 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
if (data.contains("items-collected-ids")) {
|
||||
|
||||
List<Integer> ids = data.getIntegerList("items-collected-ids");
|
||||
List<Integer> amounts = data.getIntegerList("items-collected-amounts");
|
||||
|
||||
for (int i : ids) {
|
||||
|
||||
itemsCollected.put(Material.getMaterial(i), amounts.get(ids.indexOf(i)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.contains("blocks-used-ids")) {
|
||||
|
||||
List<Integer> ids = data.getIntegerList("blocks-used-ids");
|
||||
@ -2378,6 +2359,19 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
if (data.contains("item-delivery-ids")) {
|
||||
|
||||
List<Integer> deliveryIds = data.getIntegerList("item-delivery-ids");
|
||||
List<Integer> deliveryAmounts = data.getIntegerList("item-delivery-amounts");
|
||||
|
||||
for (int i : deliveryIds) {
|
||||
|
||||
itemsDelivered.put(Material.getMaterial(i), deliveryAmounts.get(deliveryIds.indexOf(i)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.contains("citizen-ids-to-talk-to")) {
|
||||
|
||||
List<Integer> ids = data.getIntegerList("citizen-ids-to-talk-to");
|
||||
@ -2588,10 +2582,12 @@ public class Quester {
|
||||
|
||||
public void startStageTimer() {
|
||||
|
||||
if(delayTimeLeft > -1)
|
||||
if (delayTimeLeft > -1) {
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StageTimer(plugin, this), delayTimeLeft * 50);
|
||||
else
|
||||
} else {
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StageTimer(plugin, this), currentStage.delay);
|
||||
plugin.getServer().getPlayer(name).sendMessage(currentStage.delayMessage);
|
||||
}
|
||||
|
||||
delayStartTime = System.currentTimeMillis();
|
||||
|
||||
@ -2599,10 +2595,11 @@ public class Quester {
|
||||
|
||||
public void stopStageTimer() {
|
||||
|
||||
if(delayTimeLeft > -1)
|
||||
if (delayTimeLeft > -1) {
|
||||
delayTimeLeft = delayTimeLeft - (System.currentTimeMillis() - delayStartTime);
|
||||
else
|
||||
} else {
|
||||
delayTimeLeft = currentStage.delay - (System.currentTimeMillis() - delayStartTime);
|
||||
}
|
||||
|
||||
delayOver = false;
|
||||
|
||||
@ -2610,10 +2607,11 @@ public class Quester {
|
||||
|
||||
public long getStageTime() {
|
||||
|
||||
if(delayTimeLeft > -1)
|
||||
if (delayTimeLeft > -1) {
|
||||
return delayTimeLeft - (System.currentTimeMillis() - delayStartTime);
|
||||
else
|
||||
} else {
|
||||
return currentStage.delay - (System.currentTimeMillis() - delayStartTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2731,30 +2729,24 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
public static List<Integer> getChangedSlots(Inventory inInv, ItemStack inNew)
|
||||
{
|
||||
public static List<Integer> getChangedSlots(Inventory inInv, ItemStack inNew) {
|
||||
List<Integer> changed = new ArrayList<Integer>();
|
||||
if(inInv.contains(inNew.getType()))
|
||||
{
|
||||
if (inInv.contains(inNew.getType())) {
|
||||
int amount = inNew.getAmount();
|
||||
HashMap<Integer, ? extends ItemStack> items = inInv.all(inNew.getType());
|
||||
for(int i = 0; i < inInv.getSize(); i++)
|
||||
{
|
||||
if(!items.containsKey((Integer)i))
|
||||
for (int i = 0; i < inInv.getSize(); i++) {
|
||||
if (!items.containsKey((Integer) i)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack item = items.get((Integer) i);
|
||||
int slotamount = item.getMaxStackSize() - item.getAmount();
|
||||
if(slotamount > 1)
|
||||
{
|
||||
if(amount > slotamount)
|
||||
{
|
||||
if (slotamount > 1) {
|
||||
if (amount > slotamount) {
|
||||
int toAdd = slotamount - amount;
|
||||
amount = amount - toAdd;
|
||||
changed.add(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
changed.add(i);
|
||||
amount = 0;
|
||||
break;
|
||||
@ -2762,17 +2754,16 @@ public class Quester {
|
||||
}
|
||||
}
|
||||
|
||||
if(amount > 0)
|
||||
{
|
||||
if(inInv.firstEmpty() != -1)
|
||||
if (amount > 0) {
|
||||
if (inInv.firstEmpty() != -1) {
|
||||
changed.add(inInv.firstEmpty());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(inInv.firstEmpty() != -1)
|
||||
} else {
|
||||
if (inInv.firstEmpty() != -1) {
|
||||
changed.add(inInv.firstEmpty());
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
@ -14,11 +15,9 @@ import org.bukkit.entity.EntityType;
|
||||
|
||||
public class Stage {
|
||||
|
||||
public String finished;
|
||||
Map<Material, Integer> blocksToDamage = new EnumMap<Material, Integer>(Material.class);
|
||||
Map<Material, Integer> blocksToBreak = new EnumMap<Material, Integer>(Material.class);
|
||||
Map<Material, Integer> blocksToPlace = new EnumMap<Material, Integer>(Material.class);
|
||||
Map<Map<Material, Integer>, Boolean> itemsToCollect = new HashMap<Map<Material, Integer>, Boolean>();
|
||||
Map<Material, Integer> blocksToUse = new EnumMap<Material, Integer>(Material.class);
|
||||
Map<Material, Integer> blocksToCut = new EnumMap<Material, Integer>(Material.class);
|
||||
Integer fishToCatch;
|
||||
@ -29,6 +28,35 @@ public class Stage {
|
||||
LinkedList<Location> locationsToKillWithin = new LinkedList<Location>();
|
||||
LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>();
|
||||
LinkedList<String> areaNames = new LinkedList<String>();
|
||||
|
||||
LinkedList<Material> itemsToDeliver = new LinkedList<Material>();
|
||||
LinkedList<Integer> itemAmountsToDeliver = new LinkedList<Integer>();
|
||||
LinkedList<NPC> itemDeliveryTargets = new LinkedList<NPC>(){
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
if (o instanceof LinkedList) {
|
||||
|
||||
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
|
||||
|
||||
for (NPC n : this) {
|
||||
|
||||
NPC other = otherList.get(this.indexOf(n));
|
||||
if (other.getId() != n.getId()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
ArrayList<String> deliverMessages = new ArrayList<String>();
|
||||
|
||||
LinkedList<NPC> citizensToInteract = new LinkedList<NPC>(){
|
||||
|
||||
@Override
|
||||
@ -97,16 +125,6 @@ public class Stage {
|
||||
|
||||
Stage other = (Stage) o;
|
||||
|
||||
if (other.finished != null && finished != null) {
|
||||
if (other.finished.equals(finished) == false) {
|
||||
return false;
|
||||
}
|
||||
} else if (other.finished != null && finished == null) {
|
||||
return false;
|
||||
} else if (other.finished == null && finished != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.blocksToDamage.equals(blocksToDamage) == false) {
|
||||
return false;
|
||||
}
|
||||
@ -119,10 +137,6 @@ public class Stage {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.itemsToCollect.equals(itemsToCollect) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.blocksToUse.equals(blocksToUse) == false) {
|
||||
return false;
|
||||
}
|
||||
@ -175,6 +189,22 @@ public class Stage {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.itemsToDeliver.equals(itemsToDeliver) == false){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.itemAmountsToDeliver.equals(itemAmountsToDeliver) == false){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.itemDeliveryTargets.equals(itemDeliveryTargets) == false){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.deliverMessages.equals(deliverMessages) == false){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.citizensToInteract.equals(citizensToInteract) == false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -29,18 +29,17 @@ public class StageTimer implements Runnable{
|
||||
if(quester.currentStage.script != null)
|
||||
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
||||
if(quester.currentStage.event != null)
|
||||
quester.currentStage.event.happen(player);
|
||||
quester.currentStage.event.happen(quester);
|
||||
|
||||
quester.currentQuest.completeQuest(quester);
|
||||
|
||||
}else {
|
||||
|
||||
quester.reset();
|
||||
player.sendMessage(plugin.parseString(quester.currentStage.finished, quester.currentQuest));
|
||||
if(quester.currentStage.script != null)
|
||||
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
||||
if(quester.currentStage.event != null)
|
||||
quester.currentStage.event.happen(player);
|
||||
quester.currentStage.event.happen(quester);
|
||||
quester.currentStage = quester.currentQuest.stages.get(quester.currentQuest.stages.indexOf(quester.currentStage) + 1);
|
||||
quester.addEmpties();
|
||||
quester.delayStartTime = 0;
|
||||
|
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
|
@ -1,6 +1,6 @@
|
||||
name: Quests
|
||||
main: me.blackvein.quests.Quests
|
||||
version: 1.5.1c
|
||||
version: 1.5.4
|
||||
description: Player questing system
|
||||
website: http://dev.bukkit.org/server-mods/quests/
|
||||
dev-url: https://github.com/Blackvein/Quests/
|
||||
@ -55,6 +55,12 @@ permissions:
|
||||
quests.admin.reload:
|
||||
description: Reload all Quests
|
||||
default: op
|
||||
quests.editor.create:
|
||||
description: Create new Quests
|
||||
default: op
|
||||
quests.editor.events:
|
||||
description: Create/Edit/Delete Events
|
||||
default: op
|
||||
commands:
|
||||
quests:
|
||||
description: Quests command
|
||||
@ -66,6 +72,6 @@ commands:
|
||||
quest:
|
||||
description: Quest command
|
||||
permission: quests.quest
|
||||
editor:
|
||||
description: Editor
|
||||
events:
|
||||
description: Events
|
||||
permission: quests.editor
|
@ -1,22 +1,24 @@
|
||||
quests:
|
||||
Miner:
|
||||
name: 'Stone Miner'
|
||||
ask-message: '<yellow>Mine <purple>10<yellow> blocks of <purple>Stone<yellow>, and retrieve <purple>10<yellow> pieces of <purple>Cobblestone<yellow>.'
|
||||
ask-message: '<yellow>Could you mine <purple>10<yellow> blocks of <purple>Stone<yellow>, and deliver the <purple>10<yellow> pieces of <purple>Cobblestone<yellow> to me?.'
|
||||
finish-message: '<yellow>Well done. Here is your reward.'
|
||||
redo-delay: 1800000
|
||||
requirements:
|
||||
item-ids: [270]
|
||||
item-amounts: [1]
|
||||
remove-items: [false]
|
||||
item-ids:
|
||||
- 270
|
||||
item-amounts:
|
||||
- 1
|
||||
remove-items:
|
||||
- false
|
||||
fail-requirement-message: '<red>You must have a <purple>Wooden Pickaxe<red> first.'
|
||||
stages:
|
||||
ordered:
|
||||
1:
|
||||
break-block-ids: [1]
|
||||
break-block-amounts: [10]
|
||||
|
||||
collect-item-ids: [4]
|
||||
collect-item-amounts: [10]
|
||||
quest-items: [true]
|
||||
break-block-ids:
|
||||
- 1
|
||||
break-block-amounts:
|
||||
- 10
|
||||
|
||||
rewards:
|
||||
money: 1000
|
||||
@ -28,23 +30,26 @@ quests:
|
||||
ask-message: '<yellow>Kill an assortment of Mobs.'
|
||||
finish-message: '<yellow>Excellent. Here is a <purple>Diamond Sword<yellow>.'
|
||||
requirements:
|
||||
quests: [Stone Miner]
|
||||
quests:
|
||||
- Stone Miner
|
||||
fail-requirement-message: '<red>Complete <purple>Stone Miner<red> first.'
|
||||
stages:
|
||||
ordered:
|
||||
1:
|
||||
mobs-to-kill: [Pig]
|
||||
mob-amounts: [3]
|
||||
|
||||
finished: '<yellow>Now kill <purple>2 Zombies<yellow>.'
|
||||
mobs-to-kill:
|
||||
- Pig
|
||||
mob-amounts:
|
||||
- 3
|
||||
2:
|
||||
mobs-to-kill: [Zombie]
|
||||
mob-amounts: [2]
|
||||
|
||||
finished: '<yellow>Finally, kill <purple>1 Skeleton<yellow>.'
|
||||
mobs-to-kill:
|
||||
- Zombie
|
||||
mob-amounts:
|
||||
- 2
|
||||
3:
|
||||
mobs-to-kill: [Skeleton]
|
||||
mob-amounts: [1]
|
||||
mobs-to-kill:
|
||||
- Skeleton
|
||||
mob-amounts:
|
||||
- 1
|
||||
|
||||
rewards:
|
||||
item-ids: [276]
|
||||
|
Loading…
Reference in New Issue
Block a user