Fixed more bugs.

This commit is contained in:
Blackvein 2013-09-18 17:51:36 -07:00
parent 305e238d9f
commit 8b57d1e83a
4 changed files with 53 additions and 56 deletions

View File

@ -76,10 +76,10 @@ public class Quest {
completeQuest(q); completeQuest(q);
}else { }else {
q.currentStageIndex++; q.currentStageIndex++;
setStage(q, q.currentStageIndex); setStage(q, q.currentStageIndex);
} }
q.delayStartTime = 0; q.delayStartTime = 0;
@ -91,21 +91,21 @@ public class Quest {
} }
} }
public void setStage(Quester q, int stage) { public void setStage(Quester q, int stage) {
if (stages.size() - 1 < stage) { if (stages.size() - 1 < stage) {
return; return;
} }
q.reset(); q.reset();
if(q.currentStage.script != null) if(q.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, q.getPlayer()); plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, q.getPlayer());
if(q.currentStage.event != null) if(q.currentStage.event != null)
q.currentStage.event.happen(q); q.currentStage.event.happen(q);
q.currentStage = stages.get(stage); q.currentStage = stages.get(stage);
q.addEmpties(); q.addEmpties();
@ -120,7 +120,7 @@ public class Quest {
if (stageStartMessage != null) { if (stageStartMessage != null) {
q.getPlayer().sendMessage(Quests.parseString(stageStartMessage, q.currentQuest)); q.getPlayer().sendMessage(Quests.parseString(stageStartMessage, q.currentQuest));
} }
} }
public String getName(){ public String getName(){
@ -188,13 +188,13 @@ public class Quest {
q.reset(); q.reset();
q.completedQuests.add(name); q.completedQuests.add(name);
String none = ChatColor.GRAY + "- (None)"; String none = ChatColor.GRAY + "- (None)";
String ps = Quests.parseString(finished, q.currentQuest); String ps = Quests.parseString(finished, q.currentQuest);
for (String msg : ps.split("<br>")) { 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); Quests.economy.depositPlayer(q.name, moneyReward);
none = null; none = null;
@ -267,7 +267,7 @@ public class Quest {
player.sendMessage("- " + ChatColor.DARK_GREEN + exp + ChatColor.DARK_PURPLE + " Experience"); player.sendMessage("- " + ChatColor.DARK_GREEN + exp + ChatColor.DARK_PURPLE + " Experience");
none = null; none = null;
} }
if (mcmmoSkills.isEmpty() == false) { if (mcmmoSkills.isEmpty() == false) {
for (String s : mcmmoSkills) { for (String s : mcmmoSkills) {
player.sendMessage("- " + ChatColor.DARK_GREEN + mcmmoAmounts.get(mcmmoSkills.indexOf(s)) + " " + ChatColor.DARK_PURPLE + s + " Experience"); player.sendMessage("- " + ChatColor.DARK_GREEN + mcmmoAmounts.get(mcmmoSkills.indexOf(s)) + " " + ChatColor.DARK_PURPLE + s + " Experience");
@ -278,8 +278,7 @@ public class Quest {
player.sendMessage(none); player.sendMessage(none);
} }
q.currentQuest = null; q.currentQuest = null;
System.out.println(plugin.getQuester(q.name).currentQuest.getName());
q.currentStage = null; q.currentStage = null;
q.currentStageIndex = 0; q.currentStageIndex = 0;
@ -304,12 +303,12 @@ public class Quest {
return false; return false;
if(commands.size() == other.commands.size()){ if(commands.size() == other.commands.size()){
for (int i = 0; i < commands.size(); i++) { for (int i = 0; i < commands.size(); i++) {
if (commands.get(i).equals(other.commands.get(i)) == false) if (commands.get(i).equals(other.commands.get(i)) == false)
return false; return false;
} }
}else{ }else{
return false; return false;
} }

View File

@ -1,5 +1,7 @@
package me.blackvein.quests; package me.blackvein.quests;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.mcMMO;
import java.io.File; import java.io.File;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
@ -18,7 +20,6 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import me.ThaH3lper.com.EpicBoss; import me.ThaH3lper.com.EpicBoss;
import me.ThaH3lper.com.LoadBosses.LoadBoss; import me.ThaH3lper.com.LoadBosses.LoadBoss;
import me.blackvein.quests.prompts.QuestAcceptPrompt; import me.blackvein.quests.prompts.QuestAcceptPrompt;
@ -32,7 +33,6 @@ import net.citizensnpcs.api.npc.NPC;
import net.milkbowl.vault.Vault; import net.milkbowl.vault.Vault;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission; import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
@ -63,9 +63,6 @@ import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.skills.SkillType;
public class Quests extends JavaPlugin implements ConversationAbandonedListener, ColorUtil { public class Quests extends JavaPlugin implements ConversationAbandonedListener, ColorUtil {
public final static Logger log = Logger.getLogger("Minecraft"); public final static Logger log = Logger.getLogger("Minecraft");
@ -271,7 +268,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} }
} }
public static Quests getInstance() { public static Quests getInstance() {
return instance; return instance;
} }
@ -335,13 +332,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
debug = config.getBoolean("debug-mode"); debug = config.getBoolean("debug-mode");
killDelay = config.getInt("kill-delay"); killDelay = config.getInt("kill-delay");
acceptTimeout = config.getInt("accept-timeout"); acceptTimeout = config.getInt("accept-timeout");
if (config.contains("language")) { if (config.contains("language")) {
Lang.lang = config.getString("language"); Lang.lang = config.getString("language");
} else { } else {
config.set("language", "en"); config.set("language", "en");
} }
if (config.contains("ignore-locked-quests")) { if (config.contains("ignore-locked-quests")) {
ignoreLockedQuests = config.getBoolean("ignore-locked-quests"); ignoreLockedQuests = config.getBoolean("ignore-locked-quests");
} else { } else {
@ -802,7 +799,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
for (String msg : s.split("<br>")) { for (String msg : s.split("<br>")) {
cs.sendMessage(msg); cs.sendMessage(msg);
} }
conversationFactory.buildConversation((Conversable) cs).begin(); conversationFactory.buildConversation((Conversable) cs).begin();
} else { } else {
@ -3272,9 +3269,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
return parsed; return parsed;
} }
public static String parseString(String s) { public static String parseString(String s) {
String parsed = s; String parsed = s;
parsed = parsed.replaceAll("<black>", BLACK.toString()); parsed = parsed.replaceAll("<black>", BLACK.toString());
@ -3604,7 +3601,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(milliseconds); calendar.setTimeInMillis(milliseconds);
Calendar epoch = Calendar.getInstance(); Calendar epoch = Calendar.getInstance();
epoch.setTimeInMillis(0); epoch.setTimeInMillis(0);
@ -3787,6 +3784,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
public static String getCurrency(boolean plural) { public static String getCurrency(boolean plural) {
if(Quests.economy == null)
return "Money";
if (plural) { if (plural) {
if (Quests.economy.currencyNamePlural().trim().isEmpty()) { if (Quests.economy.currencyNamePlural().trim().isEmpty()) {
return "Money"; return "Money";

View File

@ -1608,7 +1608,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
text = text.substring(0, text.length() - 1); text = text.substring(0, text.length() - 1);
return text + "\n" + YELLOW + Lang.get("stageEditorEnchantTypePrompt"); return text + "\n" + YELLOW + Lang.get("stageEditorEnchantTypePrompt");
} }
@Override @Override
@ -1789,7 +1789,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
} }
} else { } else {
for (ItemStack is : getItems(context)) { for (ItemStack is : getItems(context)) {
@ -1827,10 +1827,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
} }
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done"); text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done");
return text; return text;
} }
@ -3661,7 +3661,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
LoadBoss found = null; LoadBoss found = null;
for (LoadBoss b : Quests.epicBoss.BossLoadList) { for (LoadBoss b : Quests.epicBoss.BossLoadList) {
if (b.getName().equalsIgnoreCase(input)) { if (b.getName().equalsIgnoreCase(id)) {
found = b; found = b;
break; break;
} }
@ -3704,7 +3704,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] amounts = input.split(","); String[] amounts = input.split(" ");
LinkedList<Integer> amountList = new LinkedList<Integer>(); LinkedList<Integer> amountList = new LinkedList<Integer>();
for (String amount : amounts) { for (String amount : amounts) {

View File

@ -92,8 +92,6 @@ public class Lang {
//create prompt //create prompt
en.put("stageEditorStages", "Stages"); en.put("stageEditorStages", "Stages");
en.put("stageEditorStage", "Stage"); en.put("stageEditorStage", "Stage");
en.put("stageEditorEditStage", "Edit Stage");
en.put("stageEditorNewStage", "Add new Stage");
en.put("stageEditorBreakBlocks", "Break Blocks"); en.put("stageEditorBreakBlocks", "Break Blocks");
en.put("stageEditorDamageBlocks", "Damage Blocks"); en.put("stageEditorDamageBlocks", "Damage Blocks");
en.put("stageEditorPlaceBlocks", "Place Blocks"); en.put("stageEditorPlaceBlocks", "Place Blocks");
@ -137,9 +135,9 @@ public class Lang {
en.put("stageEditorSetItemIds", "Set item ids"); en.put("stageEditorSetItemIds", "Set item ids");
en.put("stageEditorSetKillIds", "Set NPC IDs"); en.put("stageEditorSetKillIds", "Set NPC IDs");
en.put("stageEditorSetMobTypes", "Set mob types"); en.put("stageEditorSetMobTypes", "Set mob types");
en.put("stageEditorSetKillLocations", "Set kill locations"); en.put("stageEditorSetKillLocations", "Set kill locations");
en.put("stageEditorSetKillLocationRadii", "Set kill location radii"); en.put("stageEditorSetKillLocationRadii", "Set kill location radii");
en.put("stageEditorSetKillLocationNames", "Set kill location names"); en.put("stageEditorSetKillLocationNames", "Set kill location names");
en.put("stageEditorSetLocations", "Set locations"); en.put("stageEditorSetLocations", "Set locations");
en.put("stageEditorSetLocationRadii", "Set location radii"); en.put("stageEditorSetLocationRadii", "Set location radii");
en.put("stageEditorSetLocationNames", "Set location names"); en.put("stageEditorSetLocationNames", "Set location names");
@ -148,7 +146,7 @@ public class Lang {
en.put("stageEditorSetShearAmounts", "Set shear amounts"); en.put("stageEditorSetShearAmounts", "Set shear amounts");
en.put("stageEditorSetBosses", "Set Bosses"); en.put("stageEditorSetBosses", "Set Bosses");
en.put("stageEditorAddMiniEvent", "Add mini-event"); en.put("stageEditorAddMiniEvent", "Add mini-event");
en.put("stageEditorEnterBlockIds", "Enter block IDs, separating each one by a space, or enter \'cancel\' to return."); en.put("stageEditorEnterBlockIds", "Enter block IDs, separating each one by a space, or enter \'cancel\' to return.");
en.put("stageEditorBreakBlocksPrompt", "Enter block amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); en.put("stageEditorBreakBlocksPrompt", "Enter block amounts (numbers), separating each one by a space, or enter \'cancel\' to return.");
en.put("stageEditorDamageBlocksPrompt", "Enter damage amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); en.put("stageEditorDamageBlocksPrompt", "Enter damage amounts (numbers), separating each one by a space, or enter \'cancel\' to return.");
@ -183,11 +181,11 @@ public class Lang {
en.put("stageEditorBossAmountPrompt", "Enter kill amounts (numbers), separating each one by a space, or \"cancel\" to return."); en.put("stageEditorBossAmountPrompt", "Enter kill amounts (numbers), separating each one by a space, or \"cancel\" to return.");
en.put("stageEditorStartMessagePrompt", "Enter start message, or enter \"clear\" to clear the message, or \"cancel\" to return"); en.put("stageEditorStartMessagePrompt", "Enter start message, or enter \"clear\" to clear the message, or \"cancel\" to return");
en.put("stageEditorCompleteMessagePrompt", "Enter complete message, or enter \"clear\" to clear the message, or \"cancel\" to return"); en.put("stageEditorCompleteMessagePrompt", "Enter complete message, or enter \"clear\" to clear the message, or \"cancel\" to return");
en.put("stageEditorDeliveryAddItem", "Add item"); en.put("stageEditorDeliveryAddItem", "Add item");
en.put("stageEditorDeliveryNPCs", "Set NPC IDs"); en.put("stageEditorDeliveryNPCs", "Set NPC IDs");
en.put("stageEditorDeliveryMessages", "Set delivery messages"); en.put("stageEditorDeliveryMessages", "Set delivery messages");
en.put("stageEditorContainsDuplicates", "List contains duplicates!"); en.put("stageEditorContainsDuplicates", "List contains duplicates!");
en.put("stageEditorInvalidBlockID", "is not a valid block ID!"); en.put("stageEditorInvalidBlockID", "is not a valid block ID!");
en.put("stageEditorInvalidEnchantment", "is not a valid enchantment name!"); en.put("stageEditorInvalidEnchantment", "is not a valid enchantment name!");
@ -200,11 +198,11 @@ public class Lang {
en.put("stageEditorInvalidDelay", "Delay must be at least one second!"); en.put("stageEditorInvalidDelay", "Delay must be at least one second!");
en.put("stageEditorInvalidScript", "Denizen script not found!"); en.put("stageEditorInvalidScript", "Denizen script not found!");
en.put("stageEditorInvalidBoss", "Could not find Boss with the name:"); en.put("stageEditorInvalidBoss", "Could not find Boss with the name:");
en.put("stageEditorNoCitizens", "Citizens is not installed!"); en.put("stageEditorNoCitizens", "Citizens is not installed!");
en.put("stageEditorNoEpicBoss", "EpicBoss is not installed!"); en.put("stageEditorNoEpicBoss", "EpicBoss is not installed!");
en.put("stageEditorNoDenizen", "Denizen is not installed!"); en.put("stageEditorNoDenizen", "Denizen is not installed!");
en.put("stageEditorPositiveAmount", "You must enter a positive number!"); en.put("stageEditorPositiveAmount", "You must enter a positive number!");
en.put("stageEditorNoNumber", "Input was not a number!"); en.put("stageEditorNoNumber", "Input was not a number!");
en.put("stageEditorNotGreaterThanZero", "is not greater than 0!"); en.put("stageEditorNotGreaterThanZero", "is not greater than 0!");
@ -218,14 +216,14 @@ public class Lang {
en.put("stageEditorNoMobTypes", "You must set mob types first!"); en.put("stageEditorNoMobTypes", "You must set mob types first!");
en.put("stageEditorNoKillLocations", "You must set kill locations first!"); en.put("stageEditorNoKillLocations", "You must set kill locations first!");
en.put("stageEditorNoBlockSelected", "You must select a block first."); en.put("stageEditorNoBlockSelected", "You must select a block first.");
en.put("stageEditorNoColors", "You must set colors first!"); en.put("stageEditorNoColors", "You must set colors first!");
en.put("stageEditorNoEnchantmentsSet", "No enchantments set"); en.put("stageEditorNoEnchantmentsSet", "No enchantments set");
en.put("stageEditorNoItemsSet", "No items set"); en.put("stageEditorNoItemsSet", "No items set");
en.put("stageEditorNoMobTypesSet", "No mob types set"); en.put("stageEditorNoMobTypesSet", "No mob types set");
en.put("stageEditorNoLocationsSet", "No locations set"); en.put("stageEditorNoLocationsSet", "No locations set");
en.put("stageEditorNoColorsSet", "No colors set"); en.put("stageEditorNoColorsSet", "No colors set");
en.put("stageEditorListNotSameSize", "The block IDs list and the amounts list are not the same size!"); en.put("stageEditorListNotSameSize", "The block IDs list and the amounts list are not the same size!");
en.put("stageEditorEnchantmentNotSameSize", "The enchantments list, the item id list and the enchant amount list are not the same size!"); en.put("stageEditorEnchantmentNotSameSize", "The enchantments list, the item id list and the enchant amount list are not the same size!");
en.put("stageEditorDeliveriesNotSameSize", "The item list and the NPC list are not equal in size!"); en.put("stageEditorDeliveriesNotSameSize", "The item list and the NPC list are not equal in size!");
@ -233,11 +231,11 @@ public class Lang {
en.put("stageEditorAllListsNotSameSize", "All of your lists are not the same size!"); en.put("stageEditorAllListsNotSameSize", "All of your lists are not the same size!");
en.put("stageEditorMobTypesNotSameSize", "The mob types list and the mob amounts list are not the same size!"); en.put("stageEditorMobTypesNotSameSize", "The mob types list and the mob amounts list are not the same size!");
en.put("stageEditorTameMobsNotSameSize", "The mob types list and the tame amounts list are not the same size!"); en.put("stageEditorTameMobsNotSameSize", "The mob types list and the tame amounts list are not the same size!");
en.put("stageEditorShearNotSameSize", "The sheep colors list and the shear amounts list are not the same size!"); en.put("stageEditorShearNotSameSize", "The sheep colors list and the shear amounts list are not the same size!");
en.put("stageEditorBossesNotSameSize", "The Boss IDs list and the Boss amounts list are not the same size!"); en.put("stageEditorBossesNotSameSize", "The Boss IDs list and the Boss amounts list are not the same size!");
en.put("stageEditorListContainsDuplicates", " List contains duplicates!"); en.put("stageEditorListContainsDuplicates", " List contains duplicates!");
en.put("stageEditorBreakBlocksCleared", "Break blocks objective cleared."); en.put("stageEditorBreakBlocksCleared", "Break blocks objective cleared.");
en.put("stageEditorDamageBlocksCleared", "Damage blocks objective cleared."); en.put("stageEditorDamageBlocksCleared", "Damage blocks objective cleared.");
en.put("stageEditorPlaceBlocksCleared", "Place blocks objective cleared."); en.put("stageEditorPlaceBlocksCleared", "Place blocks objective cleared.");
@ -252,17 +250,17 @@ public class Lang {
en.put("stageEditorBossesCleared", "Kill Bosses objective cleared."); en.put("stageEditorBossesCleared", "Kill Bosses objective cleared.");
en.put("stageEditorStartMessageCleared", "Start message cleared."); en.put("stageEditorStartMessageCleared", "Start message cleared.");
en.put("stageEditorCompleteMessageCleared", "Complete message cleared."); en.put("stageEditorCompleteMessageCleared", "Complete message cleared.");
en.put("stageEditorConfirmStageDelete", "Are you sure you want to delete this stage?"); en.put("stageEditorConfirmStageDelete", "Are you sure you want to delete this stage?");
en.put("stageEditorConfirmStageNote", "Any Stages after will be shifted back one spot"); en.put("stageEditorConfirmStageNote", "Any Stages after will be shifted back one spot");
en.put("stageEditorDeleteSucces", "Stage deleted successfully."); en.put("stageEditorDeleteSucces", "Stage deleted successfully.");
en.put("stageEditorEnchantments", "Enchantments"); en.put("stageEditorEnchantments", "Enchantments");
en.put("stageEditorNPCNote", "Note: You may specify the name of the NPC with <npc>"); en.put("stageEditorNPCNote", "Note: You may specify the name of the NPC with <npc>");
en.put("stageEditorOptional", "Optional"); en.put("stageEditorOptional", "Optional");
en.put("stageEditorColors", "Sheep Colors"); en.put("stageEditorColors", "Sheep Colors");
en.put("stageEditorBosses", "Bosses"); en.put("stageEditorBosses", "Bosses");
//Events //Events
en.put("eventEditorTitle", "Event Editor"); en.put("eventEditorTitle", "Event Editor");