Merge pull request #8 from BlockCat/master

Fixes and an addition.
This commit is contained in:
BlockCat 2013-08-06 12:38:10 -07:00
commit e36ea0b30c
7 changed files with 5335 additions and 5250 deletions

View File

@ -107,7 +107,11 @@ public class NpcListener implements Listener {
quester.questToTake = q.name; quester.questToTake = q.name;
String s = extracted(quester); String s = extracted(quester);
player.sendMessage(s);
for (String msg : s.split("<br>")) {
player.sendMessage(msg);
}
plugin.conversationFactory.buildConversation((Conversable) player).begin(); plugin.conversationFactory.buildConversation((Conversable) player).begin();
} else if (quester.currentQuest.equals(q) == false) { } else if (quester.currentQuest.equals(q) == false) {
@ -128,7 +132,9 @@ public class NpcListener implements Listener {
quester.questToTake = q.name; quester.questToTake = q.name;
String s = extracted(quester); String s = extracted(quester);
player.sendMessage(s); for (String msg : s.split("<br>")) {
player.sendMessage(msg);
}
plugin.conversationFactory.buildConversation((Conversable) player).begin(); plugin.conversationFactory.buildConversation((Conversable) player).begin();
} }

View File

@ -143,7 +143,10 @@ public class PlayerListener implements Listener {
+ "\n" + "\n"
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n"; + ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
player.sendMessage(s); for (String msg : s.split("<br>")) {
player.sendMessage(msg);
}
plugin.conversationFactory.buildConversation((Conversable) player).begin(); plugin.conversationFactory.buildConversation((Conversable) player).begin();
} }

View File

@ -173,7 +173,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)";
player.sendMessage(Quests.parseString(finished, q.currentQuest));
String ps = Quests.parseString(finished, q.currentQuest);
for (String msg : ps.split("<br>")) {
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;

View File

@ -391,7 +391,25 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
for (Quest q : quests.getQuests()) { for (Quest q : quests.getQuests()) {
if (q.getName().equalsIgnoreCase(input) || q.getName().toLowerCase().contains(input.toLowerCase())) { if (q.getName().equalsIgnoreCase(input)) {
loadQuest(context, q);
return new CreateMenuPrompt();
}
}
for (Quest q : quests.getQuests()) {
if (q.getName().toLowerCase().startsWith(input.toLowerCase())) {
loadQuest(context, q);
return new CreateMenuPrompt();
}
}
for (Quest q : quests.getQuests()) {
if (q.getName().toLowerCase().contains(input.toLowerCase())) {
loadQuest(context, q); loadQuest(context, q);
return new CreateMenuPrompt(); return new CreateMenuPrompt();
} }
@ -611,6 +629,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false) { if (input.equalsIgnoreCase("cancel") == 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();
}
}
context.setSessionData(CK.Q_ASK_MESSAGE, input); context.setSessionData(CK.Q_ASK_MESSAGE, input);
} }
@ -632,6 +656,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false) { if (input.equalsIgnoreCase("cancel") == 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();
}
}
context.setSessionData(CK.Q_FINISH_MESSAGE, input); context.setSessionData(CK.Q_FINISH_MESSAGE, input);
} }

View File

@ -3,6 +3,8 @@ package me.blackvein.quests;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.logging.Level;
import me.ThaH3lper.com.LoadBosses.LoadBoss; import me.ThaH3lper.com.LoadBosses.LoadBoss;
import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.ItemUtil;
import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.CitizensAPI;
@ -2072,6 +2074,13 @@ public class Quester {
} }
if (stage == null) {
currentQuest = quest;
currentQuest.completeQuest(this);
Quests.log.log(Level.SEVERE, "[Quests] Invalid stage for player: \"" + name + "\". Quest ended.");
return true;
}
currentQuest = quest; currentQuest = quest;
currentStage = stage; currentStage = stage;

View File

@ -779,6 +779,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
+ RESET + getQuest(quester.questToTake).description + "\n"; + RESET + getQuest(quester.questToTake).description + "\n";
cs.sendMessage(s); cs.sendMessage(s);
for (String msg : s.split("<br>")) {
cs.sendMessage(msg);
}
conversationFactory.buildConversation((Conversable) cs).begin(); conversationFactory.buildConversation((Conversable) cs).begin();
} else { } else {

View File

@ -69,13 +69,33 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
for (Quest quest : quests) { for (Quest quest : quests) {
if (quest.getName().equalsIgnoreCase(input) || StringUtils.containsIgnoreCase(quest.getName(), input) || numInput == (quests.indexOf(quest) + 1)) { if (quest.getName().equalsIgnoreCase(input)) {
q = quest; q = quest;
break; break;
} }
} }
if (q == null)
for (Quest quest : quests) {
if (numInput == (quests.indexOf(quest) + 1)) {
q = quest;
break;
}
}
if (q == null)
for (Quest quest : quests) {
if (StringUtils.containsIgnoreCase(quest.getName(), input)) {
q = quest;
break;
}
}
if (q == null) { if (q == null) {
cc.getForWhom().sendRawMessage(RED + "Invalid Selection!"); cc.getForWhom().sendRawMessage(RED + "Invalid Selection!");
return new QuestAcceptPrompt(plugin); return new QuestAcceptPrompt(plugin);
@ -92,7 +112,11 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
quester.questToTake = q.name; quester.questToTake = q.name;
String s = extracted(quester); String s = extracted(quester);
player.sendMessage(s);
for (String msg : s.split("<br>")) {
player.sendMessage(msg);
}
plugin.conversationFactory.buildConversation((Conversable) player).begin(); plugin.conversationFactory.buildConversation((Conversable) player).begin();
}else{ }else{
@ -117,7 +141,9 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
quester.questToTake = q.name; quester.questToTake = q.name;
String s = extracted(quester); String s = extracted(quester);
player.sendMessage(s); for (String msg : s.split("<br>")) {
player.sendMessage(msg);
}
plugin.conversationFactory.buildConversation((Conversable) player).begin(); plugin.conversationFactory.buildConversation((Conversable) player).begin();
} }