Fixed chat-event functionality

This commit is contained in:
Blackvein 2013-11-24 21:58:22 -08:00
parent da4452009f
commit 8bbf21f0b5
3 changed files with 17 additions and 7 deletions

View File

@ -172,6 +172,7 @@ public class PlayerListener implements Listener {
if (plugin.checkQuester(evt.getPlayer().getName()) == false) { if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
Quester quester = plugin.getQuester(evt.getPlayer().getName()); Quester quester = plugin.getQuester(evt.getPlayer().getName());
if (quester.currentStage != null) { if (quester.currentStage != null) {
if (quester.currentStage.chatEvents.isEmpty() == false) { if (quester.currentStage.chatEvents.isEmpty() == false) {
@ -181,7 +182,7 @@ public class PlayerListener implements Listener {
if (s.equalsIgnoreCase(chat)) { if (s.equalsIgnoreCase(chat)) {
if (quester.eventFired.get(s) == false) { if (quester.eventFired.get(s) == null || quester.eventFired.get(s) == false) {
quester.currentStage.chatEvents.get(s).fire(quester); quester.currentStage.chatEvents.get(s).fire(quester);
quester.eventFired.put(s, true); quester.eventFired.put(s, true);

View File

@ -1773,6 +1773,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
public void loadQuests() { public void loadQuests() {
boolean failedToLoad = false;
totalQuestPoints = 0;
boolean needsSaving = false;
FileConfiguration config = new YamlConfiguration(); FileConfiguration config = new YamlConfiguration();
File file = new File(this.getDataFolder(), "quests.yml"); File file = new File(this.getDataFolder(), "quests.yml");
@ -1786,10 +1790,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
e.printStackTrace(); e.printStackTrace();
} }
ConfigurationSection section1 = config.getConfigurationSection("quests"); ConfigurationSection section1;
boolean failedToLoad = false; if(config.contains("quests"))
totalQuestPoints = 0; section1 = config.getConfigurationSection("quests");
boolean needsSaving = false; else{
section1 = config.createSection("quests");
needsSaving = true;
}
for (String s : section1.getKeys(false)) { for (String s : section1.getKeys(false)) {
try { try {

View File

@ -97,9 +97,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if (context.getSessionData(pref + CK.S_USE_IDS) == null) { if (context.getSessionData(pref + CK.S_USE_IDS) == null) {
text += PINK + "" + BOLD + "4 " + RESET + PURPLE + "- " + Lang.get("stageEditorPlaceBlocks") + GRAY + " (" + Lang.get("noneSet") + ")\n"; text += PINK + "" + BOLD + "4 " + RESET + PURPLE + "- " + Lang.get("stageEditorUseBlocks") + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else { } else {
text += PINK + "" + BOLD + "4 " + RESET + PURPLE + "- " + Lang.get("stageEditorPlaceBlocks") + "\n"; text += PINK + "" + BOLD + "4 " + RESET + PURPLE + "- " + Lang.get("stageEditorUseBlocks") + "\n";
LinkedList<Integer> ids = (LinkedList<Integer>) context.getSessionData(pref + CK.S_USE_IDS); LinkedList<Integer> ids = (LinkedList<Integer>) context.getSessionData(pref + CK.S_USE_IDS);
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_USE_AMOUNTS); LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_USE_AMOUNTS);