Update quest data name for fired Actions

This commit is contained in:
PikaMug 2020-01-19 01:30:10 -05:00
parent cab90a817f
commit e04a649413
3 changed files with 19 additions and 19 deletions

View File

@ -1220,7 +1220,7 @@ public class QuestData {
} }
}; };
public LinkedHashMap<String, Boolean> eventFired = new LinkedHashMap<String, Boolean>() { public LinkedHashMap<String, Boolean> actionFired = new LinkedHashMap<String, Boolean>() {
private static final long serialVersionUID = 7106048037834965123L; private static final long serialVersionUID = 7106048037834965123L;

View File

@ -525,12 +525,12 @@ public class Quester {
} }
if (stage.chatActions.isEmpty() == false) { if (stage.chatActions.isEmpty() == false) {
for (String chatTrigger : stage.chatActions.keySet()) { for (String chatTrigger : stage.chatActions.keySet()) {
questData.get(q).eventFired.put(chatTrigger, false); questData.get(q).actionFired.put(chatTrigger, false);
} }
} }
if (stage.commandActions.isEmpty() == false) { if (stage.commandActions.isEmpty() == false) {
for (String commandTrigger : stage.commandActions.keySet()) { for (String commandTrigger : stage.commandActions.keySet()) {
questData.get(q).eventFired.put(commandTrigger, false); questData.get(q).actionFired.put(commandTrigger, false);
} }
} }
if (q.initialAction != null) { if (q.initialAction != null) {
@ -2651,10 +2651,10 @@ public class Quester {
if (questData.delayTimeLeft > 0) { if (questData.delayTimeLeft > 0) {
questSec.set("stage-delay", questData.delayTimeLeft); questSec.set("stage-delay", questData.delayTimeLeft);
} }
if (questData.eventFired.isEmpty() == false) { if (questData.actionFired.isEmpty() == false) {
LinkedList<String> chatTriggers = new LinkedList<String>(); LinkedList<String> chatTriggers = new LinkedList<String>();
for (String trigger : questData.eventFired.keySet()) { for (String trigger : questData.actionFired.keySet()) {
if (questData.eventFired.get(trigger) == true) { if (questData.actionFired.get(trigger) == true) {
chatTriggers.add(trigger); chatTriggers.add(trigger);
} }
} }
@ -2662,10 +2662,10 @@ public class Quester {
questSec.set("chat-triggers", chatTriggers); questSec.set("chat-triggers", chatTriggers);
} }
} }
if (questData.eventFired.isEmpty() == false) { if (questData.actionFired.isEmpty() == false) {
LinkedList<String> commandTriggers = new LinkedList<String>(); LinkedList<String> commandTriggers = new LinkedList<String>();
for (String commandTrigger : questData.eventFired.keySet()) { for (String commandTrigger : questData.actionFired.keySet()) {
if (questData.eventFired.get(commandTrigger) == true) { if (questData.actionFired.get(commandTrigger) == true) {
commandTriggers.add(commandTrigger); commandTriggers.add(commandTrigger);
} }
} }
@ -3081,24 +3081,24 @@ public class Quester {
} }
if (getCurrentStage(quest).chatActions.isEmpty() == false) { if (getCurrentStage(quest).chatActions.isEmpty() == false) {
for (String chatTrig : getCurrentStage(quest).chatActions.keySet()) { for (String chatTrig : getCurrentStage(quest).chatActions.keySet()) {
getQuestData(quest).eventFired.put(chatTrig, false); getQuestData(quest).actionFired.put(chatTrig, false);
} }
} }
if (questSec.contains("chat-triggers")) { if (questSec.contains("chat-triggers")) {
List<String> chatTriggers = questSec.getStringList("chat-triggers"); List<String> chatTriggers = questSec.getStringList("chat-triggers");
for (String s : chatTriggers) { for (String s : chatTriggers) {
getQuestData(quest).eventFired.put(s, true); getQuestData(quest).actionFired.put(s, true);
} }
} }
if (getCurrentStage(quest).commandActions.isEmpty() == false) { if (getCurrentStage(quest).commandActions.isEmpty() == false) {
for (String commandTrig : getCurrentStage(quest).commandActions.keySet()) { for (String commandTrig : getCurrentStage(quest).commandActions.keySet()) {
getQuestData(quest).eventFired.put(commandTrig, false); getQuestData(quest).actionFired.put(commandTrig, false);
} }
} }
if (questSec.contains("command-triggers")) { if (questSec.contains("command-triggers")) {
List<String> commandTriggers = questSec.getStringList("command-triggers"); List<String> commandTriggers = questSec.getStringList("command-triggers");
for (String s : commandTriggers) { for (String s : commandTriggers) {
getQuestData(quest).eventFired.put(s, true); getQuestData(quest).actionFired.put(s, true);
} }
} }
} }

View File

@ -406,8 +406,8 @@ public class PlayerListener implements Listener {
String chat = evt.getMessage(); String chat = evt.getMessage();
for (final String s : currentStage.getChatActions().keySet()) { for (final String s : currentStage.getChatActions().keySet()) {
if (s.equalsIgnoreCase(chat)) { if (s.equalsIgnoreCase(chat)) {
if (quester.getQuestData(quest).eventFired.get(s) == null if (quester.getQuestData(quest).actionFired.get(s) == null
|| quester.getQuestData(quest).eventFired.get(s) == false) { || quester.getQuestData(quest).actionFired.get(s) == false) {
new BukkitRunnable() { new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
@ -415,7 +415,7 @@ public class PlayerListener implements Listener {
} }
}.runTask(this.plugin); }.runTask(this.plugin);
quester.getQuestData(quest).eventFired.put(s, true); quester.getQuestData(quest).actionFired.put(s, true);
} }
} }
} }
@ -460,10 +460,10 @@ public class PlayerListener implements Listener {
String command = evt.getMessage(); String command = evt.getMessage();
for (String s : currentStage.getCommandActions().keySet()) { for (String s : currentStage.getCommandActions().keySet()) {
if (command.equalsIgnoreCase("/" + s)) { if (command.equalsIgnoreCase("/" + s)) {
if (quester.getQuestData(quest).eventFired.get(s) == null if (quester.getQuestData(quest).actionFired.get(s) == null
|| quester.getQuestData(quest).eventFired.get(s) == false) { || quester.getQuestData(quest).actionFired.get(s) == false) {
currentStage.getCommandActions().get(s).fire(quester, quest); currentStage.getCommandActions().get(s).fire(quester, quest);
quester.getQuestData(quest).eventFired.put(s, true); quester.getQuestData(quest).actionFired.put(s, true);
} }
} }
} }