Added RPGItems + EpicBossGoldEdition support

Working on Heroes support
This commit is contained in:
Blackvein 2013-10-20 13:07:24 -07:00
parent 767ae3030a
commit 9d81144810
15 changed files with 770 additions and 355 deletions

BIN
lib/EpicBossGoldEdition.jar Normal file

Binary file not shown.

BIN
lib/Heroes.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

9
lib/plugin.yml Normal file
View File

@ -0,0 +1,9 @@
name: RPG Items
main: think.rpgitems.Plugin
version: 3.3
dev-url: http://dev.bukkit.org/server-mods/rpg-items/
softdepend: [WorldGuard]
commands:
rpgitem:
description: RPG Items
usage:

30
pom.xml
View File

@ -19,9 +19,9 @@
<url>http://repo.bukkit.org/content/groups/public</url>
</repository>
<repository>
<id>citizens-repo</id>
<url>http://repo.citizensnpcs.com</url>
</repository>
<id>citizens-repo</id>
<url>http://repo.citizensnpcs.com</url>
</repository>
<repository>
<id>denizens-repo</id>
<url>http://repo.citizensnpcs.com</url>
@ -57,16 +57,30 @@
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>1.0</version>
<version>1.4.07-beta1-b2226</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/mcMMO.jar</systemPath>
</dependency>
<dependency>
<groupId>me.ThaH3lper</groupId>
<artifactId>EpicBoss</artifactId>
<version>1.0</version>
<groupId>think.rpgitems</groupId>
<artifactId>RPGItems</artifactId>
<version>3.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/EpicBossRecoded.jar</systemPath>
<systemPath>${project.basedir}/lib/RPGItems.jar</systemPath>
</dependency>
<dependency>
<groupId>me.ThaH3lper</groupId>
<artifactId>EpicBossGoldEdition</artifactId>
<version>0.0.6</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/EpicBossGoldEdition.jar</systemPath>
</dependency>
<dependency>
<groupId>com.herocraftonline</groupId>
<artifactId>Heroes</artifactId>
<version>1.5.4-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Heroes.jar</systemPath>
</dependency>
<dependency>
<groupId>think.rpgitems</groupId>

View File

@ -1,6 +1,9 @@
package me.blackvein.quests;
import java.io.File;
import java.util.UUID;
import me.ThaH3lper.com.Mobs.EpicMobs;
import me.ThaH3lper.com.Mobs.MobCommon;
import net.citizensnpcs.api.CitizensAPI;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -440,6 +443,11 @@ public class PlayerListener implements Listener {
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
}
if(quester.hasObjective("killBoss") && Quests.epicBoss.allMobs.contains(evt.getEntity().getUniqueId())) {
EpicMobs em = MobCommon.getEpicMob(evt.getEntity());
quester.killBoss(em.cmdName);
}
}
}
@ -461,6 +469,11 @@ public class PlayerListener implements Listener {
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
}
if(quester.hasObjective("killBoss") && Quests.epicBoss.allMobs.contains(evt.getEntity().getUniqueId())) {
EpicMobs em = MobCommon.getEpicMob(evt.getEntity());
quester.killBoss(em.cmdName);
}
}
}
@ -583,8 +596,7 @@ public class PlayerListener implements Listener {
quester.name = evt.getPlayer().getName();
if (new File(plugin.getDataFolder(), "data/" + quester.name + ".yml").exists()) {
quester.loadData();
} else {
} else if (Quests.genFilesOnJoin) {
quester.saveData();
}
@ -637,7 +649,10 @@ public class PlayerListener implements Listener {
}
}
quester.saveData();
if(quester.hasData()){
quester.saveData();
}
plugin.questers.remove(quester.name);

View File

@ -1,19 +1,18 @@
package me.blackvein.quests;
import com.gmail.nossr50.util.player.UserManager;
import java.util.LinkedList;
import java.util.List;
import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import com.gmail.nossr50.util.player.UserManager;
import me.blackvein.quests.util.Lang;
import think.rpgitems.item.ItemManager;
import think.rpgitems.item.RPGItem;
public class Quest {
@ -27,22 +26,16 @@ public class Quest {
Location blockStart;
Quests plugin;
Event initialEvent;
//Requirements
int moneyReq = 0;
int questPointsReq = 0;
List<ItemStack> items = new LinkedList<ItemStack>();
List<Boolean> removeItems = new LinkedList<Boolean>();
List<String> neededQuests = new LinkedList<String>();
List<String> blockQuests = new LinkedList<String>();
List<String> permissionReqs = new LinkedList<String>();
public String failRequirements = null;
//
//Rewards
int moneyReward = 0;
int questPoints = 0;
@ -50,43 +43,46 @@ public class Quest {
List<String> commands = new LinkedList<String>();
List<String> permissions = new LinkedList<String>();
LinkedList<ItemStack> itemRewards = new LinkedList<ItemStack>();
//mcMMO
List<String> mcmmoSkills = new LinkedList<String>();
List<Integer> mcmmoAmounts = new LinkedList<Integer>();
//
LinkedList<Integer> rpgItemRewardIDs = new LinkedList<Integer>();
LinkedList<Integer> rpgItemRewardAmounts = new LinkedList<Integer>();
//mcMMO
List<String> mcmmoSkills = new LinkedList<String>();
List<Integer> mcmmoAmounts = new LinkedList<Integer>();
//
//
public void nextStage(Quester q){
public void nextStage(Quester q) {
String stageCompleteMessage = q.currentStage.completeMessage;
if (stageCompleteMessage != null) {
q.getPlayer().sendMessage(Quests.parseString(stageCompleteMessage, q.currentQuest));
}
String stageCompleteMessage = q.currentStage.completeMessage;
if (stageCompleteMessage != null) {
q.getPlayer().sendMessage(Quests.parseString(stageCompleteMessage, q.currentQuest));
}
if(q.currentStage.delay < 0){
if (q.currentStage.delay < 0) {
Player player = q.getPlayer();
if(q.currentStageIndex == (q.currentQuest.stages.size() - 1)){
if (q.currentStageIndex == (q.currentQuest.stages.size() - 1)) {
if(q.currentStage.script != null)
if (q.currentStage.script != null) {
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
if(q.currentStage.finishEvent != null)
}
if (q.currentStage.finishEvent != null) {
q.currentStage.finishEvent.fire(q);
}
completeQuest(q);
}else {
} else {
q.currentStageIndex++;
setStage(q, q.currentStageIndex);
q.currentStageIndex++;
setStage(q, q.currentStageIndex);
}
q.delayStartTime = 0;
q.delayTimeLeft = -1;
}else{
} else {
q.startStageTimer();
}
@ -95,99 +91,108 @@ public class Quest {
public void setStage(Quester q, int stage) {
if (stages.size() - 1 < stage) {
return;
}
if (stages.size() - 1 < stage) {
return;
}
q.resetObjectives();
q.resetObjectives();
if(q.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, q.getPlayer());
if (q.currentStage.script != null) {
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, q.getPlayer());
}
if(q.currentStage.finishEvent != null)
q.currentStage.finishEvent.fire(q);
if (q.currentStage.finishEvent != null) {
q.currentStage.finishEvent.fire(q);
}
q.currentStage = stages.get(stage);
if(q.currentStage.startEvent != null)
q.currentStage = stages.get(stage);
if (q.currentStage.startEvent != null) {
q.currentStage.startEvent.fire(q);
}
q.addEmpties();
q.addEmpties();
q.getPlayer().sendMessage(ChatColor.GOLD + "---(Objectives)---");
for(String s : q.getObjectives()){
q.getPlayer().sendMessage(ChatColor.GOLD + "---(Objectives)---");
for (String s : q.getObjectives()) {
q.getPlayer().sendMessage(s);
q.getPlayer().sendMessage(s);
}
}
String stageStartMessage = q.currentStage.startMessage;
if (stageStartMessage != null) {
q.getPlayer().sendMessage(Quests.parseString(stageStartMessage, q.currentQuest));
}
String stageStartMessage = q.currentStage.startMessage;
if (stageStartMessage != null) {
q.getPlayer().sendMessage(Quests.parseString(stageStartMessage, q.currentQuest));
}
}
public String getName(){
public String getName() {
return name;
}
public boolean testRequirements(Quester quester){
public boolean testRequirements(Quester quester) {
return testRequirements(quester.getPlayer());
}
public boolean testRequirements(Player player){
public boolean testRequirements(Player player) {
Quester quester = plugin.getQuester(player.getName());
if(moneyReq != 0 && Quests.economy.getBalance(player.getName()) < moneyReq)
if (moneyReq != 0 && Quests.economy.getBalance(player.getName()) < moneyReq) {
return false;
}
PlayerInventory inventory = player.getInventory();
int num = 0;
for(ItemStack is : items){
for (ItemStack is : items) {
for(ItemStack stack : inventory.getContents()){
for (ItemStack stack : inventory.getContents()) {
if(stack != null){
if(ItemUtil.compareItems(is, stack, true) == 0)
if (stack != null) {
if (ItemUtil.compareItems(is, stack, true) == 0) {
num += stack.getAmount();
}
}
}
if(num < is.getAmount())
if (num < is.getAmount()) {
return false;
}
num = 0;
}
for(String s : permissionReqs){
for (String s : permissionReqs) {
if(player.hasPermission(s) == false)
if (player.hasPermission(s) == false) {
return false;
}
}
if(quester.questPoints < questPointsReq)
if (quester.questPoints < questPointsReq) {
return false;
}
if(quester.completedQuests.containsAll(neededQuests) == false)
if (quester.completedQuests.containsAll(neededQuests) == false) {
return false;
}
for (String q : blockQuests) {
if (quester.completedQuests.contains(q)) {
return false;
}
if (quester.completedQuests.contains(q)) {
return false;
}
}
return true;
}
public void completeQuest(Quester q){
public void completeQuest(Quester q) {
Player player = plugin.getServer().getPlayerExact(q.name);
q.resetObjectives();
@ -197,22 +202,30 @@ public class Quest {
String ps = Quests.parseString(finished, q.currentQuest);
for (String msg : ps.split("<br>")) {
player.sendMessage(msg);
player.sendMessage(msg);
}
if(moneyReward > 0 && Quests.economy != null){
if (moneyReward > 0 && Quests.economy != null) {
Quests.economy.depositPlayer(q.name, moneyReward);
none = null;
}
if(redoDelay > -1)
if (redoDelay > -1) {
q.completedTimes.put(this.name, System.currentTimeMillis());
}
for(ItemStack i : itemRewards){
for (ItemStack i : itemRewards) {
Quests.addItem(player, i);
none = null;
}
for(String s : commands){
for (Integer i : rpgItemRewardIDs) {
ItemStack is = ItemManager.getItemById(i).toItemStack(null);
is.setAmount(rpgItemRewardAmounts.get(rpgItemRewardIDs.indexOf(i)));
Quests.addItem(player, is);
none = null;
}
for (String s : commands) {
s = s.replaceAll("<player>", player.getName());
@ -221,21 +234,21 @@ public class Quest {
}
for(String s : permissions){
for (String s : permissions) {
Quests.permission.playerAdd(player, s);
none = null;
}
for(String s : mcmmoSkills){
for (String s : mcmmoSkills) {
UserManager.getPlayer(player).getProfile().addLevels(Quests.getMcMMOSkill(s), mcmmoAmounts.get(mcmmoSkills.indexOf(s)));
UserManager.getPlayer(player).getProfile().addLevels(Quests.getMcMMOSkill(s), mcmmoAmounts.get(mcmmoSkills.indexOf(s)));
none = null;
}
if(exp > 0){
if (exp > 0) {
player.giveExp(exp);
none = null;
}
@ -243,43 +256,51 @@ public class Quest {
player.sendMessage(ChatColor.GOLD + "**QUEST COMPLETE: " + ChatColor.YELLOW + q.currentQuest.name + ChatColor.GOLD + "**");
player.sendMessage(ChatColor.GREEN + "Rewards:");
if(questPoints > 0){
if (questPoints > 0) {
player.sendMessage("- " + ChatColor.DARK_GREEN + questPoints + " Quest Points");
q.questPoints += questPoints;
none = null;
}
for(ItemStack i : itemRewards){
if(i.hasItemMeta() && i.getItemMeta().hasDisplayName())
for (Integer i : rpgItemRewardIDs) {
RPGItem item = ItemManager.getItemById(i);
player.sendMessage("- " + ChatColor.LIGHT_PURPLE + "- " + ChatColor.ITALIC + item.getName() + ChatColor.GRAY + " x " + rpgItemRewardAmounts.get(rpgItemRewardIDs.indexOf(i)));
}
for (ItemStack i : itemRewards) {
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount());
else if(i.getDurability() != 0)
} else if (i.getDurability() != 0) {
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
else
} else {
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount());
}
none = null;
}
if(moneyReward > 1){
if (moneyReward > 1) {
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(true));
none = null;
}else if(moneyReward == 1){
} else if (moneyReward == 1) {
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(false));
none = null;
}
if(exp > 0){
if (exp > 0) {
player.sendMessage("- " + ChatColor.DARK_GREEN + exp + ChatColor.DARK_PURPLE + " Experience");
none = null;
}
if (mcmmoSkills.isEmpty() == false) {
for (String s : mcmmoSkills) {
player.sendMessage("- " + ChatColor.DARK_GREEN + mcmmoAmounts.get(mcmmoSkills.indexOf(s)) + " " + ChatColor.DARK_PURPLE + s + " Experience");
}
for (String s : mcmmoSkills) {
player.sendMessage("- " + ChatColor.DARK_GREEN + mcmmoAmounts.get(mcmmoSkills.indexOf(s)) + " " + ChatColor.DARK_PURPLE + s + " Experience");
}
}
if(none != null){
if (none != null) {
player.sendMessage(none);
}
q.currentQuest = null;
@ -292,12 +313,12 @@ public class Quest {
}
public void failQuest(Quester q){
public void failQuest(Quester q) {
Player player = plugin.getServer().getPlayerExact(q.name);
q.resetObjectives();
player.sendMessage(ChatColor.AQUA + "-- " + ChatColor.DARK_PURPLE + q.currentQuest.name + ChatColor.AQUA + " -- ");
player.sendMessage(ChatColor.AQUA + "-- " + ChatColor.DARK_PURPLE + q.currentQuest.name + ChatColor.AQUA + " -- ");
player.sendMessage(ChatColor.RED + Lang.get("questFailed"));
q.currentQuest = null;
@ -311,114 +332,148 @@ public class Quest {
}
@Override
public boolean equals(Object o){
public boolean equals(Object o) {
if(o instanceof Quest){
if (o instanceof Quest) {
Quest other = (Quest) o;
if(other.blockStart != null && blockStart != null){
if(other.blockStart.equals(blockStart) == false)
if (other.blockStart != null && blockStart != null) {
if (other.blockStart.equals(blockStart) == false) {
return false;
}else if(other.blockStart != null && blockStart == null){
}
} else if (other.blockStart != null && blockStart == null) {
return false;
}else if(other.blockStart == null && blockStart != null)
return false;
if(commands.size() == other.commands.size()){
for (int i = 0; i < commands.size(); i++) {
if (commands.get(i).equals(other.commands.get(i)) == false)
return false;
}
}else{
} else if (other.blockStart == null && blockStart != null) {
return false;
}
if(other.description.equals(description) == false)
return false;
if (commands.size() == other.commands.size()) {
if(other.initialEvent != null && initialEvent != null){
if(other.initialEvent.equals(initialEvent) == false)
for (int i = 0; i < commands.size(); i++) {
if (commands.get(i).equals(other.commands.get(i)) == false) {
return false;
}
}
} else {
return false;
}
if (other.description.equals(description) == false) {
return false;
}
if (other.initialEvent != null && initialEvent != null) {
if (other.initialEvent.equals(initialEvent) == false) {
return false;
}else if(other.initialEvent != null && initialEvent == null){
}
} else if (other.initialEvent != null && initialEvent == null) {
return false;
}else if(other.initialEvent == null && initialEvent != null)
} else if (other.initialEvent == null && initialEvent != null) {
return false;
}
if(other.exp != exp)
if (other.exp != exp) {
return false;
}
if(other.failRequirements != null && failRequirements != null){
if(other.failRequirements.equals(failRequirements) == false)
if (other.failRequirements != null && failRequirements != null) {
if (other.failRequirements.equals(failRequirements) == false) {
return false;
}else if(other.failRequirements != null && failRequirements == null){
}
} else if (other.failRequirements != null && failRequirements == null) {
return false;
}else if(other.failRequirements == null && failRequirements != null)
} else if (other.failRequirements == null && failRequirements != null) {
return false;
}
if(other.finished.equals(finished) == false)
if (other.finished.equals(finished) == false) {
return false;
}
if(other.items.equals(items) == false)
if (other.items.equals(items) == false) {
return false;
}
if(other.itemRewards.equals(itemRewards) == false)
if (other.itemRewards.equals(itemRewards) == false) {
return false;
}
if(other.mcmmoAmounts.equals(mcmmoAmounts) == false)
if (other.rpgItemRewardIDs.equals(rpgItemRewardIDs) == false) {
return false;
}
if(other.mcmmoSkills.equals(mcmmoSkills) == false)
if (other.rpgItemRewardAmounts.equals(rpgItemRewardAmounts) == false) {
return false;
}
if(other.moneyReq != moneyReq)
if (other.mcmmoAmounts.equals(mcmmoAmounts) == false) {
return false;
}
if(other.moneyReward != moneyReward)
if (other.mcmmoSkills.equals(mcmmoSkills) == false) {
return false;
}
if(other.name.equals(name) == false)
if (other.moneyReq != moneyReq) {
return false;
}
if(other.neededQuests.equals(neededQuests) == false)
if (other.moneyReward != moneyReward) {
return false;
}
if (other.blockQuests.equals(blockQuests) == false)
return false;
if (other.name.equals(name) == false) {
return false;
}
if(other.npcStart != null && npcStart != null){
if(other.npcStart.equals(npcStart) == false)
if (other.neededQuests.equals(neededQuests) == false) {
return false;
}
if (other.blockQuests.equals(blockQuests) == false) {
return false;
}
if (other.npcStart != null && npcStart != null) {
if (other.npcStart.equals(npcStart) == false) {
return false;
}else if(other.npcStart != null && npcStart == null){
}
} else if (other.npcStart != null && npcStart == null) {
return false;
}else if(other.npcStart == null && npcStart != null)
} else if (other.npcStart == null && npcStart != null) {
return false;
}
if(other.permissionReqs.equals(permissionReqs) == false)
if (other.permissionReqs.equals(permissionReqs) == false) {
return false;
}
if(other.permissions.equals(permissions) == false)
if (other.permissions.equals(permissions) == false) {
return false;
}
if(other.questPoints != questPoints)
if (other.questPoints != questPoints) {
return false;
}
if(other.questPointsReq != questPointsReq)
return false;
if(other.redoDelay != redoDelay)
if (other.questPointsReq != questPointsReq) {
return false;
}
if (other.redoDelay != redoDelay) {
return false;
}
if(other.stages.equals(stages) == false)
if (other.stages.equals(stages) == false) {
return false;
}
}
return true;
}
}

View File

@ -120,7 +120,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
if (player.hasPermission("quests.editor.delete")) {
return new SelectDeletePrompt();
} else {
player.sendMessage(RED + Lang.get("questEditorNoPermsDelete"));
player.sendMessage(RED + Lang.get("questEditorNoPermsDelete"));
return new MenuPrompt();
}
@ -154,7 +154,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
String text =
GOLD + "- Quest: " + AQUA + context.getSessionData(CK.Q_NAME) + GOLD + " -\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - "+ Lang.get("questEditorName") +"\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("questEditorName") + "\n";
if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) {
text += BLUE + "" + BOLD + "2" + RESET + RED + " - " + Lang.get("questEditorAskMessage") + " " + DARKRED + "(Required, none set)\n";
@ -175,9 +175,9 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
} else {
//something here is throwing an exception
try{
try {
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("questEditorRedoDelay") + " (" + Quests.getTime((Long) context.getSessionData(CK.Q_REDO_DELAY)) + ")\n";
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
}
@ -618,12 +618,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if (input.startsWith("++")) {
if (context.getSessionData(CK.Q_ASK_MESSAGE) != null) {
context.setSessionData(CK.Q_ASK_MESSAGE, context.getSessionData(CK.Q_ASK_MESSAGE) + " " + input.substring(2));
return new CreateMenuPrompt();
}
}
if (input.startsWith("++")) {
if (context.getSessionData(CK.Q_ASK_MESSAGE) != null) {
context.setSessionData(CK.Q_ASK_MESSAGE, context.getSessionData(CK.Q_ASK_MESSAGE) + " " + input.substring(2));
return new CreateMenuPrompt();
}
}
context.setSessionData(CK.Q_ASK_MESSAGE, input);
}
@ -645,12 +645,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if (input.startsWith("++")) {
if (context.getSessionData(CK.Q_FINISH_MESSAGE) != null) {
context.setSessionData(CK.Q_FINISH_MESSAGE, context.getSessionData(CK.Q_FINISH_MESSAGE) + " " + input.substring(2));
return new CreateMenuPrompt();
}
}
if (input.startsWith("++")) {
if (context.getSessionData(CK.Q_FINISH_MESSAGE) != null) {
context.setSessionData(CK.Q_FINISH_MESSAGE, context.getSessionData(CK.Q_FINISH_MESSAGE) + " " + input.substring(2));
return new CreateMenuPrompt();
}
}
context.setSessionData(CK.Q_FINISH_MESSAGE, input);
}
@ -833,7 +833,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
@SuppressWarnings("unchecked")
public static void saveQuest(ConversationContext cc, ConfigurationSection cs) {
public static void saveQuest(ConversationContext cc, ConfigurationSection cs) {
String edit = null;
if (cc.getSessionData(CK.ED_QUEST_EDIT) != null) {
@ -878,6 +878,8 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
Integer moneyRew = null;
Integer questPointsRew = null;
LinkedList<String> itemRews = new LinkedList<String>();
LinkedList<Integer> RPGItemRews = new LinkedList<Integer>();
LinkedList<Integer> RPGItemAmounts = new LinkedList<Integer>();
Integer expRew = null;
LinkedList<String> commandRews = null;
LinkedList<String> permRews = null;
@ -947,6 +949,17 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
}
if (cc.getSessionData(CK.REW_RPG_ITEM_IDS) != null) {
RPGItemRews = new LinkedList<Integer>();
RPGItemAmounts = new LinkedList<Integer>();
for (Integer i : (LinkedList<Integer>) cc.getSessionData(CK.REW_RPG_ITEM_IDS)) {
RPGItemRews.add(i);
}
for (Integer i : (LinkedList<Integer>) cc.getSessionData(CK.REW_RPG_ITEM_AMOUNTS)) {
RPGItemAmounts.add(i);
}
}
if (cc.getSessionData(CK.REW_EXP) != null) {
expRew = (Integer) cc.getSessionData(CK.REW_EXP);
}
@ -979,7 +992,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
ConfigurationSection reqs = cs.createSection("requirements");
List<String> items = new LinkedList<String>();
if(itemReqs != null){
if (itemReqs != null) {
for (ItemStack is : itemReqs) {
items.add(ItemUtil.serialize(is));
@ -1205,9 +1218,9 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
if (cc.getSessionData(pref + CK.S_REACH_LOCATIONS) != null) {
reachLocs = (LinkedList<String>) cc.getSessionData(pref + CK.S_REACH_LOCATIONS);
reachRadii = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS);
reachNames = (LinkedList<String>) cc.getSessionData(pref + CK.S_REACH_LOCATIONS_NAMES);
reachLocs = (LinkedList<String>) cc.getSessionData(pref + CK.S_REACH_LOCATIONS);
reachRadii = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS);
reachNames = (LinkedList<String>) cc.getSessionData(pref + CK.S_REACH_LOCATIONS_NAMES);
}
if (cc.getSessionData(pref + CK.S_TAME_TYPES) != null) {
@ -1251,11 +1264,11 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
if (cc.getSessionData(pref + CK.S_START_MESSAGE) != null) {
startMessage = (String) cc.getSessionData(pref + CK.S_START_MESSAGE);
startMessage = (String) cc.getSessionData(pref + CK.S_START_MESSAGE);
}
if (cc.getSessionData(pref + CK.S_COMPLETE_MESSAGE) != null) {
completeMessage = (String) cc.getSessionData(pref + CK.S_COMPLETE_MESSAGE);
completeMessage = (String) cc.getSessionData(pref + CK.S_COMPLETE_MESSAGE);
}
if (breakIds != null && breakIds.isEmpty() == false) {
@ -1288,12 +1301,13 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
stage.set("enchantments", enchantments);
stage.set("enchantment-item-ids", enchantmentIds);
stage.set("enchantment-amounts", enchantmentAmounts);
if(deliveryItems != null && deliveryItems.isEmpty() == false){
if (deliveryItems != null && deliveryItems.isEmpty() == false) {
LinkedList<String> items = new LinkedList<String>();
for(ItemStack is : deliveryItems)
for (ItemStack is : deliveryItems) {
items.add(ItemUtil.serialize(is));
}
stage.set("items-to-deliver", items);
}else{
} else {
stage.set("items-to-deliver", null);
}
stage.set("npc-delivery-ids", deliveryNPCIds);
@ -1330,7 +1344,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
if (moneyRew != null || questPointsRew != null || itemRews != null && itemRews.isEmpty() == false || permRews != null && permRews.isEmpty() == false || expRew != null || commandRews != null && commandRews.isEmpty() == false || mcMMOSkillRews != null) {
if (moneyRew != null || questPointsRew != null || itemRews != null && itemRews.isEmpty() == false || permRews != null && permRews.isEmpty() == false || expRew != null || commandRews != null && commandRews.isEmpty() == false || mcMMOSkillRews != null || RPGItemRews != null) {
ConfigurationSection rews = cs.createSection("rewards");
@ -1342,6 +1356,8 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
rews.set("commands", commandRews);
rews.set("mcmmo-skills", mcMMOSkillRews);
rews.set("mcmmo-levels", mcMMOSkillAmounts);
rews.set("rpgitem-ids", RPGItemRews);
rews.set("rpgitem-amounts", RPGItemAmounts);
} else {
cs.set("rewards", null);
@ -1423,6 +1439,11 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
cc.setSessionData(CK.REW_MCMMO_SKILLS, q.mcmmoSkills);
cc.setSessionData(CK.REW_MCMMO_AMOUNTS, q.mcmmoAmounts);
}
if(q.rpgItemRewardIDs.isEmpty() == false) {
cc.setSessionData(CK.REW_RPG_ITEM_IDS, q.rpgItemRewardIDs);
cc.setSessionData(CK.REW_RPG_ITEM_AMOUNTS, q.rpgItemRewardAmounts);
}
//
//Stages
@ -1700,7 +1721,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
LinkedList<String> chatEvents = new LinkedList<String>();
LinkedList<String> chatEventTriggers = new LinkedList<String>();
for(String s : stage.chatEvents.keySet()){
for (String s : stage.chatEvents.keySet()) {
chatEventTriggers.add(s);
chatEvents.add(stage.chatEvents.get(s).getName());
}
@ -1723,11 +1744,11 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
if (stage.completeMessage != null) {
cc.setSessionData(pref + CK.S_COMPLETE_MESSAGE, stage.completeMessage);
cc.setSessionData(pref + CK.S_COMPLETE_MESSAGE, stage.completeMessage);
}
if (stage.startMessage != null) {
cc.setSessionData(pref + CK.S_START_MESSAGE, stage.startMessage);
cc.setSessionData(pref + CK.S_START_MESSAGE, stage.startMessage);
}
}

View File

@ -425,13 +425,15 @@ public class Quester {
for (String boss : currentStage.bossesToKill) {
String bossName = Quests.getBoss(boss).Display;
if (bossAmountsKilled.get(bossesKilled.indexOf(boss)) < currentStage.bossAmountsToKill.get(currentStage.bossesToKill.indexOf(boss))) {
unfinishedObjectives.add(ChatColor.GREEN + "Kill " + ChatColor.ITALIC + boss + ChatColor.RESET + ChatColor.GREEN + " " + bossAmountsKilled.get(currentStage.bossesToKill.indexOf(boss)) + "/" + currentStage.bossAmountsToKill.get(currentStage.bossesToKill.indexOf(boss)));
unfinishedObjectives.add(ChatColor.GREEN + "Kill " + ChatColor.ITALIC + bossName + ChatColor.RESET + ChatColor.GREEN + " " + bossAmountsKilled.get(currentStage.bossesToKill.indexOf(boss)) + "/" + currentStage.bossAmountsToKill.get(currentStage.bossesToKill.indexOf(boss)));
} else {
unfinishedObjectives.add(ChatColor.GRAY + "Kill " + ChatColor.ITALIC + boss + ChatColor.RESET + ChatColor.GRAY + " " + currentStage.bossAmountsToKill.get(currentStage.bossesToKill.indexOf(boss)) + "/" + currentStage.bossAmountsToKill.get(currentStage.bossesToKill.indexOf(boss)));
unfinishedObjectives.add(ChatColor.GRAY + "Kill " + ChatColor.ITALIC + bossName + ChatColor.RESET + ChatColor.GRAY + " " + currentStage.bossAmountsToKill.get(currentStage.bossesToKill.indexOf(boss)) + "/" + currentStage.bossAmountsToKill.get(currentStage.bossesToKill.indexOf(boss)));
}
@ -2641,6 +2643,21 @@ public class Quester {
}
public boolean hasData() {
if(currentQuest != null || currentStage != null)
return true;
if(questPoints > 1)
return true;
if(completedQuests.isEmpty() == false)
return true;
return false;
}
public void checkQuest() {
if (currentQuest != null) {

View File

@ -2,6 +2,7 @@ package me.blackvein.quests;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.mcMMO;
import com.herocraftonline.heroes.Heroes;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
@ -21,7 +22,7 @@ import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
import me.ThaH3lper.com.EpicBoss;
import me.ThaH3lper.com.LoadBosses.LoadBoss;
import me.ThaH3lper.com.Mobs.EpicMobs;
import me.blackvein.quests.prompts.QuestAcceptPrompt;
import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang;
@ -62,19 +63,28 @@ import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import think.rpgitems.Plugin;
import think.rpgitems.item.ItemManager;
import think.rpgitems.item.RPGItem;
public class Quests extends JavaPlugin implements ConversationAbandonedListener, ColorUtil {
public final static Logger log = Logger.getLogger("Minecraft");
public final static Logger log = Logger.getLogger("Minecraft");
public static Economy economy = null;
public static Permission permission = null;
public static mcMMO mcmmo = null;
public static EpicBoss epicBoss = null;
<<<<<<< HEAD
public static think.rpgitems.Plugin rpgItems = null;
=======
public static Heroes heroes = null;
public static Plugin rpgItems;
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
public static boolean snoop = true;
public static boolean npcEffects = true;
public static boolean broadcastPartyCreation = true;
public static boolean ignoreLockedQuests = false;
public static boolean genFilesOnJoin = true;
public static int maxPartySize = 0;
public static int acceptTimeout = 20;
public static int inviteTimeout = 20;
@ -92,7 +102,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
public CitizensPlugin citizens;
public PlayerListener pListener;
public NpcListener npcListener;
public EpicBossListener bossListener;
public NpcEffectThread effListener;
public Denizen denizen = null;
public QuestTaskTrigger trigger;
@ -113,7 +122,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
pListener = new PlayerListener(this);
effListener = new NpcEffectThread(this);
npcListener = new NpcListener(this);
bossListener = new EpicBossListener(this);
instance = this;
this.conversationFactory = new ConversationFactory(this)
@ -153,9 +161,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
mcmmo = (mcMMO) getServer().getPluginManager().getPlugin("mcMMO");
}
if (getServer().getPluginManager().getPlugin("EpicBossRecoded") != null) {
epicBoss = (EpicBoss) getServer().getPluginManager().getPlugin("EpicBossRecoded");
getServer().getPluginManager().registerEvents(bossListener, this);
if (getServer().getPluginManager().getPlugin("RPG Items") != null) {
rpgItems = (Plugin) getServer().getPluginManager().getPlugin("RPG Items");
}
if (getServer().getPluginManager().getPlugin("EpicBoss Gold Edition") != null) {
epicBoss = (EpicBoss) getServer().getPluginManager().getPlugin("EpicBoss Gold Edition");
}
if (getServer().getPluginManager().getPlugin("Heroes") != null) {
epicBoss = (EpicBoss) getServer().getPluginManager().getPlugin("Heroes");
}
if (getServer().getPluginManager().getPlugin("RPG Items") != null) {
@ -275,7 +290,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
public static Quests getInstance() {
return instance;
return instance;
}
private class QuestPrompt extends StringPrompt {
@ -327,44 +342,45 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
FileConfiguration config = getConfig();
allowCommands = config.getBoolean("allow-command-questing");
allowCommandsForNpcQuests = config.getBoolean("allow-command-quests-with-npcs");
showQuestReqs = config.getBoolean("show-requirements");
allowQuitting = config.getBoolean("allow-quitting");
allowCommands = config.getBoolean("allow-command-questing", true);
allowCommandsForNpcQuests = config.getBoolean("allow-command-quests-with-npcs", false);
showQuestReqs = config.getBoolean("show-requirements", true);
allowQuitting = config.getBoolean("allow-quitting", true);
genFilesOnJoin = config.getBoolean("generate-files-on-join", true);
snoop = config.getBoolean("snoop", true);
npcEffects = config.getBoolean("show-npc-effects", true);
effect = config.getString("npc-effect", "note");
debug = config.getBoolean("debug-mode");
killDelay = config.getInt("kill-delay");
acceptTimeout = config.getInt("accept-timeout");
debug = config.getBoolean("debug-mode", false);
killDelay = config.getInt("kill-delay", 600);
acceptTimeout = config.getInt("accept-timeout", 20);
if (config.contains("language")) {
Lang.lang = config.getString("language");
Lang.lang = config.getString("language");
} else {
config.set("language", "en");
config.set("language", "en");
}
if (config.contains("ignore-locked-quests")) {
ignoreLockedQuests = config.getBoolean("ignore-locked-quests");
ignoreLockedQuests = config.getBoolean("ignore-locked-quests");
} else {
config.set("ignore-locked-quests", false);
config.set("ignore-locked-quests", false);
}
if(config.contains("broadcast-party-creation")){
if (config.contains("broadcast-party-creation")) {
broadcastPartyCreation = config.getBoolean("broadcast-party-creation");
}else{
} else {
config.set("broadcast-party-creation", true);
}
if(config.contains("max-party-size")){
if (config.contains("max-party-size")) {
maxPartySize = config.getInt("max-party-size");
}else{
} else {
config.set("max-party-size", 0);
}
if(config.contains("party-invite-timeout")){
if (config.contains("party-invite-timeout")) {
inviteTimeout = config.getInt("party-invite-timeout");
}else{
} else {
config.set("party-invite-timeout", 20);
}
@ -372,9 +388,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
questerBlacklist.add(s);
}
try{
try {
config.save(new File(this.getDataFolder(), "config.yml"));
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
}
@ -419,7 +435,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
public void printPartyHelp(Player player){
public void printPartyHelp(Player player) {
player.sendMessage(PURPLE + "- Quest Parties -");
player.sendMessage(PINK + "/quests party create - Create new party");
@ -802,7 +818,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
+ RESET + getQuest(quester.questToTake).description + "\n";
for (String msg : s.split("<br>")) {
cs.sendMessage(msg);
cs.sendMessage(msg);
}
conversationFactory.buildConversation((Conversable) cs).begin();
@ -1032,6 +1048,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} else if (cmd.getName().equalsIgnoreCase("questadmin")) {
<<<<<<< HEAD
final Player player;
if (cs instanceof Player) {
player = (Player) cs;
@ -1042,6 +1059,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (args.length == 0) {
if (player == null || player.hasPermission("quests.admin")) {
=======
if (args.length == 0) {
if (cs.hasPermission("quests.admin")) {
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
printAdminHelp(cs);
} else {
cs.sendMessage(RED + "You do not have access to that command.");
@ -1051,7 +1073,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (args[0].equalsIgnoreCase("reload")) {
if (player == null || player.hasPermission("quests.admin.reload")) {
if (cs.hasPermission("quests.admin.reload")) {
reloadQuests();
cs.sendMessage(GOLD + "Quests reloaded.");
cs.sendMessage(PURPLE + String.valueOf(quests.size()) + GOLD + " Quests loaded.");
@ -1069,7 +1091,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (args[0].equalsIgnoreCase("quit")) {
<<<<<<< HEAD
if (player == null || player.hasPermission("quests.admin.quit")) {
=======
if (cs.hasPermission("quests.admin.quit")) {
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
Player target = null;
@ -1098,7 +1124,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
quester.resetObjectives();
quester.currentStage = null;
cs.sendMessage(GREEN + target.getName() + GOLD + " has forcibly quit the Quest " + PURPLE + quester.currentQuest.name + GOLD + ".");
<<<<<<< HEAD
target.sendMessage(GREEN + ((player == null) ? "console" : player.getName()) + GOLD + " has forced you to quit the Quest " + PURPLE + quester.currentQuest.name + GOLD + ".");
=======
target.sendMessage(GREEN + cs.getName() + GOLD + " has forced you to quit the Quest " + PURPLE + quester.currentQuest.name + GOLD + ".");
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
quester.currentQuest = null;
quester.saveData();
@ -1115,7 +1145,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} else if (args[0].equalsIgnoreCase("nextstage")) {
<<<<<<< HEAD
if (player == null || player.hasPermission("quests.admin.nextstage")) {
=======
if (cs.hasPermission("quests.admin.nextstage")) {
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
Player target = null;
@ -1142,7 +1176,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} else {
cs.sendMessage(GREEN + target.getName() + GOLD + " has advanced to the next Stage in the Quest " + PURPLE + quester.currentQuest.name + GOLD + ".");
<<<<<<< HEAD
target.sendMessage(GREEN + ((player == null) ? "console" : player.getName()) + GOLD + " has advanced you to the next Stage in your Quest " + PURPLE + quester.currentQuest.name + GOLD + ".");
=======
target.sendMessage(GREEN + cs.getName() + GOLD + " has advanced you to the next Stage in your Quest " + PURPLE + quester.currentQuest.name + GOLD + ".");
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
quester.currentQuest.nextStage(quester);
quester.saveData();
@ -1159,7 +1197,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} else if (args[0].equalsIgnoreCase("finish")) {
<<<<<<< HEAD
if (player == null || player.hasPermission("quests.admin.finish")) {
=======
if (cs.hasPermission("quests.admin.finish")) {
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
Player target = null;
@ -1186,7 +1228,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} else {
cs.sendMessage(GREEN + target.getName() + GOLD + " has advanced to the next Stage in the Quest " + PURPLE + quester.currentQuest.name + GOLD + ".");
<<<<<<< HEAD
target.sendMessage(GREEN + ((player == null) ? "console" : player.getName()) + GOLD + " has advanced you to the next Stage in your Quest " + PURPLE + quester.currentQuest.name + GOLD + ".");
=======
target.sendMessage(GREEN + cs.getName() + GOLD + " has advanced you to the next Stage in your Quest " + PURPLE + quester.currentQuest.name + GOLD + ".");
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
quester.currentQuest.completeQuest(quester);
quester.saveData();
@ -1203,7 +1249,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} else if (args[0].equalsIgnoreCase("pointsall")) {
<<<<<<< HEAD
if (player == null || player.hasPermission("quests.admin.points.all")) {
=======
if (cs.hasPermission("quests.admin.points.all")) {
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
final int amount;
@ -1273,7 +1323,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} else {
<<<<<<< HEAD
cs.sendMessage(RED + "You do not have access to that command.");
=======
cs.sendMessage(RED + "You do not have access to that command.");
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
}
@ -1287,7 +1341,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (args[0].equalsIgnoreCase("give")) {
<<<<<<< HEAD
if (player == null || player.hasPermission("quests.admin.give")) {
=======
if (cs.hasPermission("quests.admin.give")) {
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
Player target = null;
@ -1368,7 +1426,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
quester.currentStage = questToGive.stages.getFirst();
quester.addEmpties();
cs.sendMessage(GREEN + target.getName() + GOLD + " has forcibly started the Quest " + PURPLE + questToGive.name + GOLD + ".");
<<<<<<< HEAD
target.sendMessage(GREEN + ((player == null) ? "console" : player.getName()) + GOLD + " has forced you to take the Quest " + PURPLE + questToGive.name + GOLD + ".");
=======
target.sendMessage(GREEN + cs.getName() + GOLD + " has forced you to take the Quest " + PURPLE + questToGive.name + GOLD + ".");
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
target.sendMessage(GOLD + "---(Objectives)---");
for (String s : quester.getObjectives()) {
target.sendMessage(s);
@ -1388,7 +1450,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} else if (args[0].equalsIgnoreCase("points")) {
<<<<<<< HEAD
if (player == null || player.hasPermission("quests.admin.points")) {
=======
if (cs.hasPermission("quests.admin.points")) {
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
Player target = null;
@ -1423,7 +1489,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
Quester quester = getQuester(target.getName());
quester.questPoints = points;
cs.sendMessage(GREEN + target.getName() + GOLD + "\'s Quest Points have been set to " + PURPLE + points + GOLD + ".");
<<<<<<< HEAD
target.sendMessage(GREEN + ((player == null) ? "console" : player.getName()) + GOLD + " has set your Quest Points to " + PURPLE + points + GOLD + ".");
=======
target.sendMessage(GREEN + cs.getName() + GOLD + " has set your Quest Points to " + PURPLE + points + GOLD + ".");
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
quester.saveData();
@ -1437,99 +1507,148 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} else if (args[0].equalsIgnoreCase("takepoints")) {
<<<<<<< HEAD
if (player == null || player.hasPermission("quests.admin.takepoints")) {
=======
if (cs.hasPermission("quests.admin.takepoints")) {
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
Player target = null;
Player target = null;
for (Player p : getServer().getOnlinePlayers()) {
for (Player p : getServer().getOnlinePlayers()) {
if (p.getName().equalsIgnoreCase(args[1])) {
target = p;
break;
}
if (p.getName().equalsIgnoreCase(args[1])) {
target = p;
break;
}
}
}
if (target == null) {
if (target == null) {
<<<<<<< HEAD
cs.sendMessage(YELLOW + "Player not found.");
=======
cs.sendMessage(YELLOW + "Player not found.");
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
} else {
} else {
int points;
int points;
try {
try {
points = Integer.parseInt(args[2]);
points = Integer.parseInt(args[2]);
} catch (Exception e) {
} catch (Exception e) {
<<<<<<< HEAD
cs.sendMessage(YELLOW + "Amount must be a number.");
return true;
=======
cs.sendMessage(YELLOW + "Amount must be a number.");
return true;
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
}
}
<<<<<<< HEAD
Quester quester = getQuester(target.getName());
quester.questPoints -= Math.abs(points);
cs.sendMessage(GOLD + "Took away " + PURPLE + points + GOLD + " Quest Points from " + GREEN + target.getName() + GOLD + "\'s.");
target.sendMessage(GREEN + ((player == null) ? "console" : player.getName()) + GOLD + " took away " + PURPLE + points + GOLD + " Quest Points.");
=======
Quester quester = getQuester(target.getName());
quester.questPoints -= Math.abs(points);
cs.sendMessage(GOLD + "Took away " + PURPLE + points + GOLD + " Quest Points from " + GREEN + target.getName() + GOLD + "\'s.");
target.sendMessage(GREEN + cs.getName() + GOLD + " took away " + PURPLE + points + GOLD + " Quest Points.");
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
quester.saveData();
quester.saveData();
}
}
} else {
} else {
<<<<<<< HEAD
cs.sendMessage(RED + "You do not have access to that command.");
=======
cs.sendMessage(RED + "You do not have access to that command.");
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
}
}
} else if (args[0].equalsIgnoreCase("givepoints")) {
<<<<<<< HEAD
if (player == null || player.hasPermission("quests.admin.givepoints")) {
=======
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
Player target = null;
if (cs.hasPermission("quests.admin.givepoints")) {
for (Player p : getServer().getOnlinePlayers()) {
Player target = null;
if (p.getName().equalsIgnoreCase(args[1])) {
target = p;
break;
}
for (Player p : getServer().getOnlinePlayers()) {
}
if (p.getName().equalsIgnoreCase(args[1])) {
target = p;
break;
}
if (target == null) {
}
<<<<<<< HEAD
cs.sendMessage(YELLOW + "Player not found.");
=======
if (target == null) {
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
} else {
cs.sendMessage(YELLOW + "Player not found.");
int points;
} else {
try {
int points;
points = Integer.parseInt(args[2]);
try {
} catch (Exception e) {
points = Integer.parseInt(args[2]);
<<<<<<< HEAD
cs.sendMessage(YELLOW + "Amount must be a number.");
return true;
=======
} catch (Exception e) {
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
}
cs.sendMessage(YELLOW + "Amount must be a number.");
return true;
<<<<<<< HEAD
Quester quester = getQuester(target.getName());
quester.questPoints += Math.abs(points);
cs.sendMessage(GOLD + "Gave " + PURPLE + points + GOLD + " Quest Points to " + GREEN + target.getName() + GOLD + "\'s.");
target.sendMessage(GREEN + ((player == null) ? "console" : player.getName()) + GOLD + " gave you " + PURPLE + points + GOLD + " Quest Points.");
=======
}
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
quester.saveData();
Quester quester = getQuester(target.getName());
quester.questPoints += Math.abs(points);
cs.sendMessage(GOLD + "Gave " + PURPLE + points + GOLD + " Quest Points to " + GREEN + target.getName() + GOLD + "\'s.");
target.sendMessage(GREEN + cs.getName() + GOLD + " gave you " + PURPLE + points + GOLD + " Quest Points.");
}
quester.saveData();
} else {
}
} else {
<<<<<<< HEAD
cs.sendMessage(RED + "You do not have access to that command.");
=======
cs.sendMessage(RED + "You do not have access to that command.");
>>>>>>> Added RPGItems + EpicBossGoldEdition Support
}
}
} else {
cs.sendMessage(YELLOW + "Unknown Questadmin command. Type /questadmin for help.");
@ -1830,7 +1949,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (config.contains("quests." + s + ".requirements.remove-items")) {
if (Quests.checkList(config.getList("quests." + s + ".requirements.remove-items"), Boolean.class)) {
quest.removeItems.clear();
quest.removeItems.clear();
quest.removeItems.addAll(config.getBooleanList("quests." + s + ".requirements.remove-items"));
} else {
printSevere("[Quests] remove-items: Requirement for Quest " + quest.name + " is not a list of true/false values!");
@ -1955,7 +2074,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (config.contains("quests." + s + ".requirements.permissions")) {
if (Quests.checkList(config.getList("quests." + s + ".requirements.permissions"), String.class)) {
quest.permissionReqs.clear();
quest.permissionReqs.clear();
quest.permissionReqs.addAll(config.getStringList("quests." + s + ".requirements.permissions"));
} else {
printSevere("[Quests] permissions: Requirement for Quest " + quest.name + " is not a list of permissions!");
@ -2009,7 +2128,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
trigger = new QuestTaskTrigger();
stage.script = config.getString("quests." + s + ".stages.ordered." + s2 + ".script-to-run");
} else {
printSevere("[Quests] script-to-run: in Stage " + s2 + " of Quest " + quest.name + " is not a Denizen script!");
printSevere("[Quests] script-to-run: in Stage " + s2 + " of Quest " + quest.name + " is not a Denizen script!");
stageFailed = true;
break;
}
@ -2119,7 +2238,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (Material.getMaterial(i) != null) {
stage.blocksToPlace.put(Material.getMaterial(i), placeamounts.get(placeids.indexOf(i)));
} else {
printSevere("[Quests] " + + i + " inside place-block-ids: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid item ID!");
printSevere("[Quests] " + +i + " inside place-block-ids: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid item ID!");
stageFailed = true;
break;
}
@ -2538,7 +2657,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} else {
printSevere("[Quests] "+ mob + " inside mobs-to-kill: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid mob name!");
printSevere("[Quests] " + mob + " inside mobs-to-kill: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid mob name!");
stageFailed = true;
break;
@ -3038,9 +3157,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".chat-events")) {
if(config.isList("quests." + s + ".stages.ordered." + s2 + ".chat-events")){
if (config.isList("quests." + s + ".stages.ordered." + s2 + ".chat-events")) {
if(config.contains("quests." + s + ".stages.ordered." + s2 + ".chat-event-triggers")){
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".chat-event-triggers")) {
if (config.isList("quests." + s + ".stages.ordered." + s2 + ".chat-event-triggers")) {
@ -3073,13 +3192,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
break;
}
}else{
} else {
printSevere("[Quests] Stage " + s2 + " of Quest " + quest.name + " is missing chat-event-triggers!");
stageFailed = true;
break;
}
}else{
} else {
printSevere("[Quests] chat-events in Stage " + s2 + " of Quest " + quest.name + " is not in list format!");
stageFailed = true;
break;
@ -3118,7 +3237,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
LinkedList<Integer> ids = new LinkedList<Integer>();
if(npcIdsToTalkTo != null){
if (npcIdsToTalkTo != null) {
ids.addAll(npcIdsToTalkTo);
}
stage.citizensToInteract = ids;
@ -3166,6 +3285,61 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
if (config.contains("quests." + s + ".rewards.rpgitem-ids")) {
if (Quests.checkList(config.getList("quests." + s + ".rewards.rpgitem-ids"), Integer.class)) {
if(config.contains("quests." + s + ".rewards.rpgitem-amounts")){
if(Quests.checkList(config.getList("quests." + s + ".rewards.rpgitem-amounts"), Integer.class)){
boolean failed = false;
for (Integer id : config.getIntegerList("quests." + s + ".rewards.rpgitem-ids")) {
try {
RPGItem item = ItemManager.getItemById(id);
if (item != null) {
quest.rpgItemRewardIDs.add(id);
} else {
printSevere("[Quests] " + id + " in rpgitem-ids: Reward in Quest " + quest.name + " is not a valid RPGItem id!");
failed = true;
break;
}
} catch (Exception e) {
printSevere("[Quests] " + id + " in rpgitem-ids: Reward in Quest " + quest.name + " is not properly formatted!");
failed = true;
break;
}
}
for(Integer amount : config.getIntegerList("quests." + s + ".rewards.rpgitem-amounts")) {
quest.rpgItemRewardAmounts.add(amount);
}
if (failed) {
continue;
}
}else{
printSevere("[Quests] rpgitem-amounts: Reward in Quest " + quest.name + " is not a list of numbers!");
break;
}
}else {
printSevere("[Quests] Rewards for Quest " + quest.name + " is missing rpgitem-amounts");
continue;
}
} else {
printSevere("[Quests] rpgitem-ids: Reward in Quest " + quest.name + " is not a list of numbers!");
continue;
}
}
if (config.contains("quests." + s + ".rewards.money")) {
if (config.getInt("quests." + s + ".rewards.money", -999) != -999) {
@ -3191,7 +3365,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (config.contains("quests." + s + ".rewards.commands")) {
if (Quests.checkList(config.getList("quests." + s + ".rewards.commands"), String.class)) {
quest.commands.clear();
quest.commands.clear();
quest.commands.addAll(config.getStringList("quests." + s + ".rewards.commands"));
} else {
printSevere("[Quests] commands: Reward in Quest " + quest.name + " is not a list of commands!");
@ -3203,7 +3377,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (config.contains("quests." + s + ".rewards.permissions")) {
if (Quests.checkList(config.getList("quests." + s + ".rewards.permissions"), String.class)) {
quest.permissions.clear();
quest.permissions.clear();
quest.permissions.addAll(config.getStringList("quests." + s + ".rewards.permissions"));
} else {
printSevere("[Quests] permissions: Reward in Quest " + quest.name + " is not a list of permissions!");
@ -3264,7 +3438,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
//
quests.add(quest);
if(needsSaving){
if (needsSaving) {
config.save(file);
}
@ -3350,7 +3524,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
return parsed;
}
public static String parseString(String s, NPC npc){
public static String parseString(String s, NPC npc) {
String parsed = s;
@ -3391,7 +3565,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
public static String parseString(String s) {
String parsed = s;
String parsed = s;
parsed = parsed.replaceAll("<black>", BLACK.toString());
parsed = parsed.replaceAll("<darkblue>", DARKBLUE.toString());
@ -3634,6 +3808,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
return EntityType.GIANT;
} else if (mob.equalsIgnoreCase("Horse")) {
return EntityType.HORSE;
} else if (mob.equalsIgnoreCase("IronGolem")) {
return EntityType.IRON_GOLEM;
@ -3767,13 +3945,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
message += " " + seconds + " Seconds,";
}
} else {
if (milliSeconds2 > 0) {
if (milliSeconds2 == 1) {
if (milliSeconds2 > 0) {
if (milliSeconds2 == 1) {
message += " 1 Millisecond,";
} else {
message += " " + milliSeconds2 + " Milliseconds,";
}
}
}
}
message = message.substring(1, message.length() - 1);
@ -3903,8 +4081,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
public static String getCurrency(boolean plural) {
if(Quests.economy == null)
if (Quests.economy == null) {
return "Money";
}
if (plural) {
if (Quests.economy.currencyNamePlural().trim().isEmpty()) {
@ -4062,7 +4241,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
public String getNPCName(int id){
public String getNPCName(int id) {
return citizens.getNPCRegistry().getById(id).getName();
@ -4430,11 +4609,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
return false;
}
public static LoadBoss getBoss(String name) {
public static EpicMobs getBoss(String name) {
for (LoadBoss b : Quests.epicBoss.BossLoadList) {
if (b.getName().equalsIgnoreCase(name)) {
return b;
for (EpicMobs em : Quests.epicBoss.listMobs) {
if (em.cmdName.equalsIgnoreCase(name)) {
return em;
}
}

View File

@ -3,7 +3,7 @@ package me.blackvein.quests.prompts;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import me.ThaH3lper.com.LoadBosses.LoadBoss;
import me.ThaH3lper.com.Mobs.EpicMobs;
import me.blackvein.quests.ColorUtil;
import me.blackvein.quests.Event;
import me.blackvein.quests.QuestFactory;
@ -3927,10 +3927,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
LinkedList<String> ids = (LinkedList<String>) cc.getSessionData(pref + "bossIds");
for (String id : ids) {
for (LoadBoss b : Quests.epicBoss.BossLoadList) {
for (EpicMobs em : Quests.epicBoss.listMobs) {
if (b.getName().equalsIgnoreCase(id)) {
text += GOLD + " - " + YELLOW + b.getName() + "\n";
if (em.cmdName.equalsIgnoreCase(id)) {
text += GOLD + " - " + YELLOW + em.cmdName + "\n";
break;
}
@ -3999,12 +3999,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext cc) {
String text = GOLD + "- " + DARKRED + Lang.get("stageEditorBosses") + GOLD + " -\n";
if (Quests.epicBoss.BossLoadList.isEmpty()) {
if (Quests.epicBoss.listMobs.isEmpty()) {
text += RED + "- " + Lang.get("none") + "\n";
} else {
for (LoadBoss b : Quests.epicBoss.BossLoadList) {
text += RED + " - " + b.getName() + "\n";
for (EpicMobs em : Quests.epicBoss.listMobs) {
text += RED + " - " + em.cmdName + "\n";
}
}
@ -4024,11 +4024,11 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
LinkedList<String> idList = new LinkedList<String>();
for (String id : ids) {
LoadBoss found = null;
EpicMobs found = null;
for (LoadBoss b : Quests.epicBoss.BossLoadList) {
if (b.getName().equalsIgnoreCase(id)) {
found = b;
for (EpicMobs em : Quests.epicBoss.listMobs) {
if (em.cmdName.equalsIgnoreCase(id)) {
found = em;
break;
}
}
@ -4037,11 +4037,11 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
cc.getForWhom().sendRawMessage(RED + Lang.get("stageEditorInvalidBoss") + " " + id + "!");
return new EpicBossIDListPrompt();
} else {
if (idList.contains(found.getName())) {
if (idList.contains(found.cmdName)) {
cc.getForWhom().sendRawMessage(RED + Lang.get("stageEditorContainsDuplicates"));
return new EpicBossIDListPrompt();
} else {
idList.add(found.getName());
idList.add(found.cmdName);
}
}

View File

@ -16,6 +16,8 @@ import org.bukkit.conversations.NumericPrompt;
import org.bukkit.conversations.Prompt;
import org.bukkit.conversations.StringPrompt;
import org.bukkit.inventory.ItemStack;
import think.rpgitems.item.ItemManager;
import think.rpgitems.item.RPGItem;
public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
@ -26,7 +28,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
public RewardsPrompt(Quests plugin, QuestFactory qf){
super("1", "2", "3", "4", "5", "6", "7", "8");
super("1", "2", "3", "4", "5", "6", "7", "8", "9");
quests = plugin;
factory = qf;
@ -54,16 +56,43 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set item rewards\n";
//RPGItems
if(Quests.rpgItems != null){
if(context.getSessionData(CK.REW_RPG_ITEM_IDS) == null)
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set RPGItem rewards (None set)\n";
else{
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set RPGItem rewards\n";
List<Integer> rpgItems = (List<Integer>) context.getSessionData(CK.REW_RPG_ITEM_IDS);
List<Integer> rpgItemAmounts = (List<Integer>) context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS);
for(Integer i : rpgItems){
RPGItem item = ItemManager.getItemById(i);
text += GRAY + " - " + PINK + ITALIC + item.getName() + RESET + GRAY + " x " + PURPLE + rpgItemAmounts.get(rpgItems.indexOf(i)) + "\n";
}
}
}else{
text += GRAY + "4 - Set RPGItem rewards (RPGItems not installed)\n";
}
//
if(context.getSessionData(CK.REW_EXP) == null)
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set experience reward (None set)\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set experience reward (None set)\n";
else{
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set experience reward (" + context.getSessionData(CK.REW_EXP) + " points)\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set experience reward (" + context.getSessionData(CK.REW_EXP) + " points)\n";
}
if(context.getSessionData(CK.REW_COMMAND) == null)
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set command rewards (None set)\n";
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set command rewards (None set)\n";
else{
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set command rewards\n";
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set command rewards\n";
List<String> commands = (List<String>) context.getSessionData(CK.REW_COMMAND);
for(String cmd : commands){
@ -74,9 +103,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}
if(context.getSessionData(CK.REW_PERMISSION) == null)
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set permission rewards (None set)\n";
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set permission rewards (None set)\n";
else{
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set permission rewards\n";
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set permission rewards\n";
List<String> permissions = (List<String>) context.getSessionData(CK.REW_PERMISSION);
for(String perm : permissions){
@ -91,9 +120,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
if(Quests.mcmmo != null){
if(context.getSessionData(CK.REW_MCMMO_SKILLS) == null)
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set mcMMO skill rewards (None set)\n";
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set mcMMO skill rewards (None set)\n";
else{
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set mcMMO skill rewards\n";
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set mcMMO skill rewards\n";
List<String> skills = (List<String>) context.getSessionData(CK.REW_MCMMO_SKILLS);
List<Integer> amounts = (List<Integer>) context.getSessionData(CK.REW_MCMMO_AMOUNTS);
@ -104,15 +133,14 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}
}
}else{
text += GRAY + "8 - Set mcMMO skill rewards (mcMMO not installed)\n";
}
//
if(Quests.mcmmo != null)
text += GREEN + "" + BOLD + "8" + RESET + YELLOW + " - Done";
else
text += GREEN + "" + BOLD + "7" + RESET + YELLOW + " - Done";
text += GREEN + "" + BOLD + "9" + RESET + YELLOW + " - Done";
return text;
@ -128,21 +156,23 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}else if(input.equalsIgnoreCase("3")){
return new ItemListPrompt();
}else if(input.equalsIgnoreCase("4")){
return new ExperiencePrompt();
if(Quests.rpgItems != null)
return new RPGItemsPrompt();
else
return new RewardsPrompt(quests, factory);
}else if(input.equalsIgnoreCase("5")){
return new CommandsPrompt();
return new ExperiencePrompt();
}else if(input.equalsIgnoreCase("6")){
return new PermissionsPrompt();
return new CommandsPrompt();
}else if(input.equalsIgnoreCase("7")){
return new PermissionsPrompt();
}else if(input.equalsIgnoreCase("8")){
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);
}else if(input.equalsIgnoreCase("9")){
return factory.returnToMenu();
}
return null;
@ -300,17 +330,89 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
}
/*private class ItemIdsPrompt extends StringPrompt {
private class RPGItemsPrompt extends FixedSetPrompt {
public RPGItemsPrompt(){
super("1", "2", "3");
}
@Override
public String getPromptText(ConversationContext context){
return YELLOW + "Enter item IDs separating each one by a space, or enter \'cancel\' to return.";
String text = GOLD + "- RPGItem Rewards -\n";
if(context.getSessionData(CK.REW_RPG_ITEM_IDS) == null){
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set IDs\n";
}else{
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set IDs\n";
for(Integer i : (List<Integer>) context.getSessionData(CK.REW_RPG_ITEM_IDS)){
text += AQUA + " - " + i + "\n";
}
}
if(context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS) == null){
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set amounts\n";
}else{
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set amounts\n";
for(Integer i : (List<Integer>) context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS)){
text += AQUA + " - " + i + "\n";
}
}
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Done";
return text;
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, String input){
if(input.equalsIgnoreCase("1")){
return new RPGItemIdsPrompt();
}else if(input.equalsIgnoreCase("2")){
return new RPGItemAmountsPrompt();
}else if(input.equalsIgnoreCase("3")){
int one;
int two;
if(context.getSessionData(CK.REW_RPG_ITEM_IDS) != null)
one = ((List<Integer>) context.getSessionData(CK.REW_RPG_ITEM_IDS)).size();
else
one = 0;
if(context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS) != null)
two = ((List<Integer>) context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS)).size();
else
two = 0;
if(one == two)
return new RewardsPrompt(quests, factory);
else{
context.getForWhom().sendRawMessage(RED + "The " + GOLD + "IDs list " + RED + "and " + GOLD + "amounts list " + RED + "are not the same size!");
return new RPGItemsPrompt();
}
}
return null;
}
}
private class RPGItemIdsPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context){
return YELLOW + "Enter RPGItem IDs (or names) separating each one by a space, or enter \'clear\' to clear the list, or \'cancel\' to return.";
}
@Override
public Prompt acceptInput(ConversationContext context, String input){
if(input.equalsIgnoreCase("cancel") == false){
if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
String[] args = input.split(" ");
LinkedList<Integer> ids = new LinkedList<Integer>();
@ -318,48 +420,63 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
try{
if(Material.getMaterial(Integer.parseInt(s)) != null){
int id = Integer.parseInt(s);
if(ids.contains(Integer.parseInt(s)) == false){
ids.add(Integer.parseInt(s));
}else{
context.getForWhom().sendRawMessage(RED + "List contains duplicates!");
return new ItemIdsPrompt();
}
if(ids.contains(id)){
context.getForWhom().sendRawMessage(RED + "Error: List contains duplicates!");
return new RPGItemIdsPrompt();
}
}else{
context.getForWhom().sendRawMessage(PINK + s + RED + " is not a valid item ID!");
return new ItemIdsPrompt();
RPGItem item = ItemManager.getItemById(id);
if(item != null){
ids.add(id);
}else {
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ", not an RPGItem ID or name!");
return new RPGItemIdsPrompt();
}
}catch (Exception e){
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
return new ItemIdsPrompt();
RPGItem item = ItemManager.getItemByName(s);
if(item == null){
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ", not an RPGItem ID or name!");
return new RPGItemIdsPrompt();
}else{
ids.add(item.getID());
}
}
}
context.setSessionData("itemIdRews", ids);
context.setSessionData(CK.REW_RPG_ITEM_IDS, ids);
}else if(input.equalsIgnoreCase("clear")){
context.setSessionData(CK.REW_RPG_ITEM_IDS, null);
context.getForWhom().sendRawMessage(YELLOW + "RPGItem IDs cleared.");
}
return new ItemListPrompt();
return new RPGItemsPrompt();
}
}*/
}
/*private class ItemAmountsPrompt extends StringPrompt {
private class RPGItemAmountsPrompt 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.";
return YELLOW + "Enter RPGItem amounts (numbers) separating each one by a space, or enter \'clear\' to clear the list, or \'cancel\' to return.";
}
@Override
public Prompt acceptInput(ConversationContext context, String input){
if(input.equalsIgnoreCase("cancel") == false){
if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
String[] args = input.split(" ");
LinkedList<Integer> amounts = new LinkedList<Integer>();
@ -371,26 +488,31 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{
amounts.add(Integer.parseInt(s));
else{
context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!");
return new ItemAmountsPrompt();
return new RPGItemAmountsPrompt();
}
}catch (Exception e){
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
return new ItemAmountsPrompt();
return new RPGItemAmountsPrompt();
}
}
context.setSessionData("itemAmountRews", amounts);
context.setSessionData(CK.REW_RPG_ITEM_AMOUNTS, amounts);
}else if(input.equalsIgnoreCase("clear")){
context.setSessionData(CK.REW_RPG_ITEM_AMOUNTS, null);
context.getForWhom().sendRawMessage(YELLOW + "RPGItem amounts cleared.");
}
return new ItemListPrompt();
return new RPGItemsPrompt();
}
}*/
}
private class CommandsPrompt extends StringPrompt {

View File

@ -29,6 +29,8 @@ public class CK {
public static final String REW_MONEY = "moneyRew";
public static final String REW_QUEST_POINTS = "questPointsRew";
public static final String REW_ITEMS = "itemRews";
public static final String REW_RPG_ITEM_IDS = "rpgItemRewIDs";
public static final String REW_RPG_ITEM_AMOUNTS = "rpgItemRewAmounts";
public static final String REW_EXP = "expRew";
public static final String REW_COMMAND = "commandRews";
public static final String REW_PERMISSION = "permissionRews";

View File

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