mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-28 05:35:33 +01:00
Denizen scripts are now under Actions
This commit is contained in:
parent
21c19f7e28
commit
776e28cb0a
@ -18,7 +18,7 @@ public class DenizenTrigger {
|
|||||||
public DenizenTrigger(Quests plugin) {
|
public DenizenTrigger(Quests plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
protected boolean runDenizenScript(String scriptName, Quester quester) {
|
public boolean runDenizenScript(String scriptName, Quester quester) {
|
||||||
if (scriptName == null) {
|
if (scriptName == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -208,8 +208,8 @@ public class Quest {
|
|||||||
quester.findCompassTarget();
|
quester.findCompassTarget();
|
||||||
}
|
}
|
||||||
if (currentStage.delay < 0) {
|
if (currentStage.delay < 0) {
|
||||||
if (currentStage.finishEvent != null) {
|
if (currentStage.finishAction != null) {
|
||||||
currentStage.finishEvent.fire(quester, this);
|
currentStage.finishAction.fire(quester, this);
|
||||||
}
|
}
|
||||||
if (quester.currentQuests.get(this) == (orderedStages.size() - 1)) {
|
if (quester.currentQuests.get(this) == (orderedStages.size() - 1)) {
|
||||||
if (currentStage.script != null) {
|
if (currentStage.script != null) {
|
||||||
@ -266,8 +266,8 @@ public class Quest {
|
|||||||
if (currentStage.script != null) {
|
if (currentStage.script != null) {
|
||||||
plugin.getDenizenTrigger().runDenizenScript(currentStage.script, quester);
|
plugin.getDenizenTrigger().runDenizenScript(currentStage.script, quester);
|
||||||
}
|
}
|
||||||
if (nextStage.startEvent != null) {
|
if (nextStage.startAction != null) {
|
||||||
nextStage.startEvent.fire(quester, this);
|
nextStage.startAction.fire(quester, this);
|
||||||
}
|
}
|
||||||
updateCompass(quester, nextStage);
|
updateCompass(quester, nextStage);
|
||||||
String msg = Lang.get(quester.getPlayer(), "questObjectivesTitle");
|
String msg = Lang.get(quester.getPlayer(), "questObjectivesTitle");
|
||||||
|
@ -885,34 +885,34 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT, countList);
|
cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT, countList);
|
||||||
cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA, datamapList);
|
cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA, datamapList);
|
||||||
}
|
}
|
||||||
if (stage.startEvent != null) {
|
if (stage.startAction != null) {
|
||||||
cc.setSessionData(pref + CK.S_START_EVENT, stage.startEvent.getName());
|
cc.setSessionData(pref + CK.S_START_EVENT, stage.startAction.getName());
|
||||||
}
|
}
|
||||||
if (stage.finishEvent != null) {
|
if (stage.finishAction != null) {
|
||||||
cc.setSessionData(pref + CK.S_FINISH_EVENT, stage.finishEvent.getName());
|
cc.setSessionData(pref + CK.S_FINISH_EVENT, stage.finishAction.getName());
|
||||||
}
|
}
|
||||||
if (stage.deathEvent != null) {
|
if (stage.deathAction != null) {
|
||||||
cc.setSessionData(pref + CK.S_DEATH_EVENT, stage.deathEvent.getName());
|
cc.setSessionData(pref + CK.S_DEATH_EVENT, stage.deathAction.getName());
|
||||||
}
|
}
|
||||||
if (stage.disconnectEvent != null) {
|
if (stage.disconnectAction != null) {
|
||||||
cc.setSessionData(pref + CK.S_DISCONNECT_EVENT, stage.disconnectEvent.getName());
|
cc.setSessionData(pref + CK.S_DISCONNECT_EVENT, stage.disconnectAction.getName());
|
||||||
}
|
}
|
||||||
if (stage.chatEvents != null) {
|
if (stage.chatActions != null) {
|
||||||
LinkedList<String> chatEvents = new LinkedList<String>();
|
LinkedList<String> chatEvents = new LinkedList<String>();
|
||||||
LinkedList<String> chatEventTriggers = new LinkedList<String>();
|
LinkedList<String> chatEventTriggers = new LinkedList<String>();
|
||||||
for (String s : stage.chatEvents.keySet()) {
|
for (String s : stage.chatActions.keySet()) {
|
||||||
chatEventTriggers.add(s);
|
chatEventTriggers.add(s);
|
||||||
chatEvents.add(stage.chatEvents.get(s).getName());
|
chatEvents.add(stage.chatActions.get(s).getName());
|
||||||
}
|
}
|
||||||
cc.setSessionData(pref + CK.S_CHAT_EVENTS, chatEvents);
|
cc.setSessionData(pref + CK.S_CHAT_EVENTS, chatEvents);
|
||||||
cc.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers);
|
cc.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers);
|
||||||
}
|
}
|
||||||
if (stage.commandEvents != null) {
|
if (stage.commandActions != null) {
|
||||||
LinkedList<String> commandEvents = new LinkedList<String>();
|
LinkedList<String> commandEvents = new LinkedList<String>();
|
||||||
LinkedList<String> commandEventTriggers = new LinkedList<String>();
|
LinkedList<String> commandEventTriggers = new LinkedList<String>();
|
||||||
for (String s : stage.commandEvents.keySet()) {
|
for (String s : stage.commandActions.keySet()) {
|
||||||
commandEventTriggers.add(s);
|
commandEventTriggers.add(s);
|
||||||
commandEvents.add(stage.commandEvents.get(s).getName());
|
commandEvents.add(stage.commandActions.get(s).getName());
|
||||||
}
|
}
|
||||||
cc.setSessionData(pref + CK.S_COMMAND_EVENTS, commandEvents);
|
cc.setSessionData(pref + CK.S_COMMAND_EVENTS, commandEvents);
|
||||||
cc.setSessionData(pref + CK.S_COMMAND_EVENT_TRIGGERS, commandEventTriggers);
|
cc.setSessionData(pref + CK.S_COMMAND_EVENT_TRIGGERS, commandEventTriggers);
|
||||||
|
@ -523,21 +523,21 @@ public class Quester {
|
|||||||
getPlayer().sendMessage(ConfigUtil
|
getPlayer().sendMessage(ConfigUtil
|
||||||
.parseStringWithPossibleLineBreaks(stageStartMessage, q, getPlayer()));
|
.parseStringWithPossibleLineBreaks(stageStartMessage, q, getPlayer()));
|
||||||
}
|
}
|
||||||
if (stage.chatEvents.isEmpty() == false) {
|
if (stage.chatActions.isEmpty() == false) {
|
||||||
for (String chatTrigger : stage.chatEvents.keySet()) {
|
for (String chatTrigger : stage.chatActions.keySet()) {
|
||||||
questData.get(q).eventFired.put(chatTrigger, false);
|
questData.get(q).eventFired.put(chatTrigger, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stage.commandEvents.isEmpty() == false) {
|
if (stage.commandActions.isEmpty() == false) {
|
||||||
for (String commandTrigger : stage.commandEvents.keySet()) {
|
for (String commandTrigger : stage.commandActions.keySet()) {
|
||||||
questData.get(q).eventFired.put(commandTrigger, false);
|
questData.get(q).eventFired.put(commandTrigger, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (q.initialAction != null) {
|
if (q.initialAction != null) {
|
||||||
q.initialAction.fire(this, q);
|
q.initialAction.fire(this, q);
|
||||||
}
|
}
|
||||||
if (stage.startEvent != null) {
|
if (stage.startAction != null) {
|
||||||
stage.startEvent.fire(this, q);
|
stage.startAction.fire(this, q);
|
||||||
}
|
}
|
||||||
q.updateCompass(this, stage);
|
q.updateCompass(this, stage);
|
||||||
saveData();
|
saveData();
|
||||||
@ -3078,8 +3078,8 @@ public class Quester {
|
|||||||
if (questSec.contains("stage-delay")) {
|
if (questSec.contains("stage-delay")) {
|
||||||
getQuestData(quest).delayTimeLeft = questSec.getLong("stage-delay");
|
getQuestData(quest).delayTimeLeft = questSec.getLong("stage-delay");
|
||||||
}
|
}
|
||||||
if (getCurrentStage(quest).chatEvents.isEmpty() == false) {
|
if (getCurrentStage(quest).chatActions.isEmpty() == false) {
|
||||||
for (String chatTrig : getCurrentStage(quest).chatEvents.keySet()) {
|
for (String chatTrig : getCurrentStage(quest).chatActions.keySet()) {
|
||||||
getQuestData(quest).eventFired.put(chatTrig, false);
|
getQuestData(quest).eventFired.put(chatTrig, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3089,8 +3089,8 @@ public class Quester {
|
|||||||
getQuestData(quest).eventFired.put(s, true);
|
getQuestData(quest).eventFired.put(s, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCurrentStage(quest).commandEvents.isEmpty() == false) {
|
if (getCurrentStage(quest).commandActions.isEmpty() == false) {
|
||||||
for (String commandTrig : getCurrentStage(quest).commandEvents.keySet()) {
|
for (String commandTrig : getCurrentStage(quest).commandActions.keySet()) {
|
||||||
getQuestData(quest).eventFired.put(commandTrig, false);
|
getQuestData(quest).eventFired.put(commandTrig, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2829,7 +2829,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
Action evt = Action.loadAction(config.getString("quests." + questKey + ".stages.ordered." + s2
|
Action evt = Action.loadAction(config.getString("quests." + questKey + ".stages.ordered." + s2
|
||||||
+ ".start-event"), this);
|
+ ".start-event"), this);
|
||||||
if (evt != null) {
|
if (evt != null) {
|
||||||
oStage.startEvent = evt;
|
oStage.startAction = evt;
|
||||||
} else {
|
} else {
|
||||||
stageFailed("start-event: in Stage " + s2 + " of Quest " + quest.getName() + " failed to load.");
|
stageFailed("start-event: in Stage " + s2 + " of Quest " + quest.getName() + " failed to load.");
|
||||||
}
|
}
|
||||||
@ -2838,7 +2838,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
Action evt = Action.loadAction(config.getString("quests." + questKey + ".stages.ordered." + s2
|
Action evt = Action.loadAction(config.getString("quests." + questKey + ".stages.ordered." + s2
|
||||||
+ ".finish-event"), this);
|
+ ".finish-event"), this);
|
||||||
if (evt != null) {
|
if (evt != null) {
|
||||||
oStage.finishEvent = evt;
|
oStage.finishAction = evt;
|
||||||
} else {
|
} else {
|
||||||
stageFailed("finish-event: in Stage " + s2 + " of Quest " + quest.getName() + " failed to load.");
|
stageFailed("finish-event: in Stage " + s2 + " of Quest " + quest.getName() + " failed to load.");
|
||||||
}
|
}
|
||||||
@ -2847,7 +2847,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
Action evt = Action.loadAction(config.getString("quests." + questKey + ".stages.ordered." + s2
|
Action evt = Action.loadAction(config.getString("quests." + questKey + ".stages.ordered." + s2
|
||||||
+ ".death-event"), this);
|
+ ".death-event"), this);
|
||||||
if (evt != null) {
|
if (evt != null) {
|
||||||
oStage.deathEvent = evt;
|
oStage.deathAction = evt;
|
||||||
} else {
|
} else {
|
||||||
stageFailed("death-event: in Stage " + s2 + " of Quest " + quest.getName() + " failed to load.");
|
stageFailed("death-event: in Stage " + s2 + " of Quest " + quest.getName() + " failed to load.");
|
||||||
}
|
}
|
||||||
@ -2856,7 +2856,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
Action evt = Action.loadAction(config.getString("quests." + questKey + ".stages.ordered." + s2
|
Action evt = Action.loadAction(config.getString("quests." + questKey + ".stages.ordered." + s2
|
||||||
+ ".disconnect-event"), this);
|
+ ".disconnect-event"), this);
|
||||||
if (evt != null) {
|
if (evt != null) {
|
||||||
oStage.disconnectEvent = evt;
|
oStage.disconnectAction = evt;
|
||||||
} else {
|
} else {
|
||||||
stageFailed("disconnect-event: in Stage " + s2 + " of Quest " + quest.getName()
|
stageFailed("disconnect-event: in Stage " + s2 + " of Quest " + quest.getName()
|
||||||
+ " failed to load.");
|
+ " failed to load.");
|
||||||
@ -2874,7 +2874,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
for (int i = 0; i < chatEvents.size(); i++) {
|
for (int i = 0; i < chatEvents.size(); i++) {
|
||||||
Action evt = Action.loadAction(chatEvents.get(i), this);
|
Action evt = Action.loadAction(chatEvents.get(i), this);
|
||||||
if (evt != null) {
|
if (evt != null) {
|
||||||
oStage.chatEvents.put(chatEventTriggers.get(i), evt);
|
oStage.chatActions.put(chatEventTriggers.get(i), evt);
|
||||||
} else {
|
} else {
|
||||||
loadEventFailed = true;
|
loadEventFailed = true;
|
||||||
stageFailed("" + chatEvents.get(i) + " inside of chat-events: in Stage " + s2
|
stageFailed("" + chatEvents.get(i) + " inside of chat-events: in Stage " + s2
|
||||||
@ -2909,7 +2909,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
for (int i = 0; i < commandEvents.size(); i++) {
|
for (int i = 0; i < commandEvents.size(); i++) {
|
||||||
Action evt = Action.loadAction(commandEvents.get(i), this);
|
Action evt = Action.loadAction(commandEvents.get(i), this);
|
||||||
if (evt != null) {
|
if (evt != null) {
|
||||||
oStage.commandEvents.put(commandEventTriggers.get(i), evt);
|
oStage.commandActions.put(commandEventTriggers.get(i), evt);
|
||||||
} else {
|
} else {
|
||||||
loadEventFailed = true;
|
loadEventFailed = true;
|
||||||
stageFailed("" + commandEvents.get(i) + " inside of command-events: in Stage " + s2
|
stageFailed("" + commandEvents.get(i) + " inside of command-events: in Stage " + s2
|
||||||
|
@ -116,12 +116,12 @@ public class Stage {
|
|||||||
protected LinkedList<String> passwordDisplays = new LinkedList<String>();
|
protected LinkedList<String> passwordDisplays = new LinkedList<String>();
|
||||||
protected LinkedList<LinkedList<String>> passwordPhrases = new LinkedList<LinkedList<String>>();
|
protected LinkedList<LinkedList<String>> passwordPhrases = new LinkedList<LinkedList<String>>();
|
||||||
protected String script;
|
protected String script;
|
||||||
protected Action startEvent = null;
|
protected Action startAction = null;
|
||||||
protected Action deathEvent = null;
|
protected Action deathAction = null;
|
||||||
protected Map<String, Action> chatEvents = new HashMap<String, Action>();
|
protected Map<String, Action> chatActions = new HashMap<String, Action>();
|
||||||
protected Map<String, Action> commandEvents = new HashMap<String, Action>();
|
protected Map<String, Action> commandActions = new HashMap<String, Action>();
|
||||||
protected Action disconnectEvent = null;
|
protected Action disconnectAction = null;
|
||||||
protected Action finishEvent = null;
|
protected Action finishAction = null;
|
||||||
protected long delay = -1;
|
protected long delay = -1;
|
||||||
protected String delayMessage = null;
|
protected String delayMessage = null;
|
||||||
protected String completeMessage = null;
|
protected String completeMessage = null;
|
||||||
@ -395,52 +395,52 @@ public class Stage {
|
|||||||
this.script = script;
|
this.script = script;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action getStartEvent() {
|
public Action getStartAction() {
|
||||||
return startEvent;
|
return startAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartEvent(Action startEvent) {
|
public void setStartAction(Action startAction) {
|
||||||
this.startEvent = startEvent;
|
this.startAction = startAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action getDeathEvent() {
|
public Action getDeathAction() {
|
||||||
return deathEvent;
|
return deathAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeathEvent(Action deathEvent) {
|
public void setDeathAction(Action deathAction) {
|
||||||
this.deathEvent = deathEvent;
|
this.deathAction = deathAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Action> getChatEvents() {
|
public Map<String, Action> getChatActions() {
|
||||||
return chatEvents;
|
return chatActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChatEvents(Map<String, Action> chatEvents) {
|
public void setChatActions(Map<String, Action> chatActions) {
|
||||||
this.chatEvents = chatEvents;
|
this.chatActions = chatActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Action> getCommandEvents() {
|
public Map<String, Action> getCommandActions() {
|
||||||
return commandEvents;
|
return commandActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCommandEvents(Map<String, Action> commandEvents) {
|
public void setCommandActions(Map<String, Action> commandActions) {
|
||||||
this.commandEvents = commandEvents;
|
this.commandActions = commandActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action getDisconnectEvent() {
|
public Action getDisconnectAction() {
|
||||||
return disconnectEvent;
|
return disconnectAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDisconnectEvent(Action disconnectEvent) {
|
public void setDisconnectAction(Action disconnectAction) {
|
||||||
this.disconnectEvent = disconnectEvent;
|
this.disconnectAction = disconnectAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action getFinishEvent() {
|
public Action getFinishAction() {
|
||||||
return finishEvent;
|
return finishAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFinishEvent(Action finishEvent) {
|
public void setFinishAction(Action finishAction) {
|
||||||
this.finishEvent = finishEvent;
|
this.finishAction = finishAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getDelay() {
|
public long getDelay() {
|
||||||
|
@ -89,6 +89,7 @@ public class Action {
|
|||||||
protected float health = -1;
|
protected float health = -1;
|
||||||
protected Location teleport;
|
protected Location teleport;
|
||||||
protected String book = "";
|
protected String book = "";
|
||||||
|
protected String denizenScript;
|
||||||
|
|
||||||
public Action(final Quests plugin) {
|
public Action(final Quests plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@ -269,6 +270,14 @@ public class Action {
|
|||||||
public void setBook(String book) {
|
public void setBook(String book) {
|
||||||
this.book = book;
|
this.book = book;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDenizenScript() {
|
||||||
|
return book;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDenizenScript(String scriptName) {
|
||||||
|
this.denizenScript = scriptName;
|
||||||
|
}
|
||||||
|
|
||||||
public void fire(Quester quester, Quest quest) {
|
public void fire(Quester quester, Quest quest) {
|
||||||
Player player = quester.getPlayer();
|
Player player = quester.getPlayer();
|
||||||
@ -399,6 +408,9 @@ public class Action {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (denizenScript != null) {
|
||||||
|
plugin.getDenizenTrigger().runDenizenScript(denizenScript, quester);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Action loadAction(String name, Quests plugin) {
|
public static Action loadAction(String name, Quests plugin) {
|
||||||
@ -689,7 +701,8 @@ public class Action {
|
|||||||
if (data.contains(actionKey + "potion-effect-durations")) {
|
if (data.contains(actionKey + "potion-effect-durations")) {
|
||||||
if (ConfigUtil.checkList(data.getList(actionKey + "potion-effect-durations"), Integer.class)) {
|
if (ConfigUtil.checkList(data.getList(actionKey + "potion-effect-durations"), Integer.class)) {
|
||||||
if (data.contains(actionKey + "potion-effect-amplifiers")) {
|
if (data.contains(actionKey + "potion-effect-amplifiers")) {
|
||||||
if (ConfigUtil.checkList(data.getList(actionKey + "potion-effect-amplifiers"), Integer.class)) {
|
if (ConfigUtil.checkList(data.getList(actionKey + "potion-effect-amplifiers"),
|
||||||
|
Integer.class)) {
|
||||||
List<String> types = data.getStringList(actionKey + "potion-effect-types");
|
List<String> types = data.getStringList(actionKey + "potion-effect-types");
|
||||||
List<Integer> durations = data.getIntegerList(actionKey + "potion-effect-durations");
|
List<Integer> durations = data.getIntegerList(actionKey + "potion-effect-durations");
|
||||||
List<Integer> amplifiers = data.getIntegerList(actionKey + "potion-effect-amplifiers");
|
List<Integer> amplifiers = data.getIntegerList(actionKey + "potion-effect-amplifiers");
|
||||||
@ -802,6 +815,9 @@ public class Action {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (data.contains(actionKey + "denizen-script")) {
|
||||||
|
action.denizenScript = data.getString(actionKey + "denizen-script");
|
||||||
|
}
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class ActionMainPrompt extends NumericPrompt {
|
public class ActionMainPrompt extends NumericPrompt {
|
||||||
private final int size = 9;
|
private final int size = 10;
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return size;
|
return size;
|
||||||
@ -273,10 +273,16 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
case 7:
|
case 7:
|
||||||
return ChatColor.BLUE;
|
if (plugin.getDependencies().getDenizenAPI() == null) {
|
||||||
|
return ChatColor.GRAY;
|
||||||
|
} else {
|
||||||
|
return ChatColor.BLUE;
|
||||||
|
}
|
||||||
case 8:
|
case 8:
|
||||||
return ChatColor.GREEN;
|
return ChatColor.BLUE;
|
||||||
case 9:
|
case 9:
|
||||||
|
return ChatColor.GREEN;
|
||||||
|
case 10:
|
||||||
return ChatColor.RED;
|
return ChatColor.RED;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@ -298,10 +304,16 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
case 6:
|
case 6:
|
||||||
return ChatColor.YELLOW + Lang.get("eventEditorSetMobSpawns");
|
return ChatColor.YELLOW + Lang.get("eventEditorSetMobSpawns");
|
||||||
case 7:
|
case 7:
|
||||||
return ChatColor.YELLOW + Lang.get("eventEditorFailQuest") + ":";
|
if (plugin.getDependencies().getDenizenAPI() == null) {
|
||||||
|
return ChatColor.GRAY + Lang.get("stageEditorDenizenScript");
|
||||||
|
} else {
|
||||||
|
return ChatColor.YELLOW + Lang.get("stageEditorDenizenScript");
|
||||||
|
}
|
||||||
case 8:
|
case 8:
|
||||||
return ChatColor.GREEN + Lang.get("save");
|
return ChatColor.YELLOW + Lang.get("eventEditorFailQuest") + ":";
|
||||||
case 9:
|
case 9:
|
||||||
|
return ChatColor.GREEN + Lang.get("save");
|
||||||
|
case 10:
|
||||||
return ChatColor.RED + Lang.get("exit");
|
return ChatColor.RED + Lang.get("exit");
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@ -333,12 +345,23 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
case 7:
|
case 7:
|
||||||
|
if (plugin.getDependencies().getDenizenAPI() == null) {
|
||||||
|
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||||
|
} else {
|
||||||
|
if (context.getSessionData(CK.E_DENIZEN) == null) {
|
||||||
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
|
} else {
|
||||||
|
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_DENIZEN)
|
||||||
|
+ ChatColor.GRAY + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 8:
|
||||||
if (context.getSessionData(CK.E_FAIL_QUEST) == null) {
|
if (context.getSessionData(CK.E_FAIL_QUEST) == null) {
|
||||||
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
|
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
|
||||||
}
|
}
|
||||||
return "" + ChatColor.AQUA + context.getSessionData(CK.E_FAIL_QUEST);
|
return "" + ChatColor.AQUA + context.getSessionData(CK.E_FAIL_QUEST);
|
||||||
case 8:
|
|
||||||
case 9:
|
case 9:
|
||||||
|
case 10:
|
||||||
return "";
|
return "";
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@ -375,6 +398,8 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
case 6:
|
case 6:
|
||||||
return new MobPrompt();
|
return new MobPrompt();
|
||||||
case 7:
|
case 7:
|
||||||
|
return new DenizenPrompt();
|
||||||
|
case 8:
|
||||||
String s = (String) context.getSessionData(CK.E_FAIL_QUEST);
|
String s = (String) context.getSessionData(CK.E_FAIL_QUEST);
|
||||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||||
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
|
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
|
||||||
@ -382,13 +407,13 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("yesWord"));
|
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("yesWord"));
|
||||||
}
|
}
|
||||||
return new ActionMainPrompt();
|
return new ActionMainPrompt();
|
||||||
case 8:
|
case 9:
|
||||||
if (context.getSessionData(CK.E_OLD_EVENT) != null) {
|
if (context.getSessionData(CK.E_OLD_EVENT) != null) {
|
||||||
return new SavePrompt((String) context.getSessionData(CK.E_OLD_EVENT));
|
return new SavePrompt((String) context.getSessionData(CK.E_OLD_EVENT));
|
||||||
} else {
|
} else {
|
||||||
return new SavePrompt(null);
|
return new SavePrompt(null);
|
||||||
}
|
}
|
||||||
case 9:
|
case 10:
|
||||||
return new ExitPrompt();
|
return new ExitPrompt();
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@ -577,8 +602,8 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
if (a != null) {
|
if (a != null) {
|
||||||
for (Quest quest : plugin.getQuests()) {
|
for (Quest quest : plugin.getQuests()) {
|
||||||
for (Stage stage : quest.getStages()) {
|
for (Stage stage : quest.getStages()) {
|
||||||
if (stage.getFinishEvent() != null
|
if (stage.getFinishAction() != null
|
||||||
&& stage.getFinishEvent().getName().equalsIgnoreCase(a.getName())) {
|
&& stage.getFinishAction().getName().equalsIgnoreCase(a.getName())) {
|
||||||
used.add(quest.getName());
|
used.add(quest.getName());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -945,8 +970,8 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
modName = modifiedName;
|
modName = modifiedName;
|
||||||
for (Quest q : plugin.getQuests()) {
|
for (Quest q : plugin.getQuests()) {
|
||||||
for (Stage s : q.getStages()) {
|
for (Stage s : q.getStages()) {
|
||||||
if (s.getFinishEvent() != null && s.getFinishEvent().getName() != null) {
|
if (s.getFinishAction() != null && s.getFinishAction().getName() != null) {
|
||||||
if (s.getFinishEvent().getName().equalsIgnoreCase(modifiedName)) {
|
if (s.getFinishAction().getName().equalsIgnoreCase(modifiedName)) {
|
||||||
modified.add(q.getName());
|
modified.add(q.getName());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1253,6 +1278,9 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
section.set("cancel-timer", true);
|
section.set("cancel-timer", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (context.getSessionData(CK.E_DENIZEN) != null) {
|
||||||
|
section.set("denizen-script", getCString(context, CK.E_DENIZEN));
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
data.save(actionsFile);
|
data.save(actionsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -2673,4 +2701,37 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class DenizenPrompt extends StringPrompt {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPromptText(ConversationContext context) {
|
||||||
|
String text = ChatColor.DARK_AQUA + "- " + Lang.get("stageEditorDenizenScript") + " -\n";
|
||||||
|
for (String s : plugin.getDependencies().getDenizenAPI()._getScriptNames()) {
|
||||||
|
text += ChatColor.AQUA + "- " + s + "\n";
|
||||||
|
}
|
||||||
|
return text + ChatColor.YELLOW + Lang.get("stageEditorScriptPrompt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
|
Player player = (Player) context.getForWhom();
|
||||||
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||||
|
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||||
|
if (plugin.getDependencies().getDenizenAPI().containsScript(input)) {
|
||||||
|
context.setSessionData(CK.E_DENIZEN, input.toUpperCase());
|
||||||
|
return new ActionMainPrompt();
|
||||||
|
} else {
|
||||||
|
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidScript"));
|
||||||
|
return new DenizenPrompt();
|
||||||
|
}
|
||||||
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
|
context.setSessionData(CK.E_DENIZEN, null);
|
||||||
|
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDenizenCleared"));
|
||||||
|
return new ActionMainPrompt();
|
||||||
|
} else {
|
||||||
|
return new ActionMainPrompt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,16 +402,16 @@ public class PlayerListener implements Listener {
|
|||||||
+ " on chat for quest " + quest.getName());
|
+ " on chat for quest " + quest.getName());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (currentStage.getChatEvents().isEmpty() == false) {
|
if (currentStage.getChatActions().isEmpty() == false) {
|
||||||
String chat = evt.getMessage();
|
String chat = evt.getMessage();
|
||||||
for (final String s : currentStage.getChatEvents().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).eventFired.get(s) == null
|
||||||
|| quester.getQuestData(quest).eventFired.get(s) == false) {
|
|| quester.getQuestData(quest).eventFired.get(s) == false) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
currentStage.getChatEvents().get(s).fire(quester, quest);
|
currentStage.getChatActions().get(s).fire(quester, quest);
|
||||||
}
|
}
|
||||||
|
|
||||||
}.runTask(this.plugin);
|
}.runTask(this.plugin);
|
||||||
@ -456,13 +456,13 @@ public class PlayerListener implements Listener {
|
|||||||
+ " on command for quest " + quest.getName());
|
+ " on command for quest " + quest.getName());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (currentStage.getCommandEvents().isEmpty() == false) {
|
if (currentStage.getCommandActions().isEmpty() == false) {
|
||||||
String command = evt.getMessage();
|
String command = evt.getMessage();
|
||||||
for (String s : currentStage.getCommandEvents().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).eventFired.get(s) == null
|
||||||
|| quester.getQuestData(quest).eventFired.get(s) == false) {
|
|| quester.getQuestData(quest).eventFired.get(s) == false) {
|
||||||
currentStage.getCommandEvents().get(s).fire(quester, quest);
|
currentStage.getCommandActions().get(s).fire(quester, quest);
|
||||||
quester.getQuestData(quest).eventFired.put(s, true);
|
quester.getQuestData(quest).eventFired.put(s, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -833,8 +833,8 @@ public class PlayerListener implements Listener {
|
|||||||
Quester quester = plugin.getQuester(target.getUniqueId());
|
Quester quester = plugin.getQuester(target.getUniqueId());
|
||||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||||
Stage stage = quester.getCurrentStage(quest);
|
Stage stage = quester.getCurrentStage(quest);
|
||||||
if (stage != null && stage.getDeathEvent() != null) {
|
if (stage != null && stage.getDeathAction() != null) {
|
||||||
quester.getCurrentStage(quest).getDeathEvent().fire(quester, quest);
|
quester.getCurrentStage(quest).getDeathAction().fire(quester, quest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -982,8 +982,8 @@ public class PlayerListener implements Listener {
|
|||||||
if (currentStage.getDelay() > -1) {
|
if (currentStage.getDelay() > -1) {
|
||||||
quester.stopStageTimer(quest);
|
quester.stopStageTimer(quest);
|
||||||
}
|
}
|
||||||
if (currentStage.getDisconnectEvent() != null) {
|
if (currentStage.getDisconnectAction() != null) {
|
||||||
currentStage.getDisconnectEvent().fire(quester, quest);
|
currentStage.getDisconnectAction().fire(quester, quest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Integer timerId : quester.getTimers().keySet()) {
|
for (Integer timerId : quester.getTimers().keySet()) {
|
||||||
|
@ -47,7 +47,7 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
private final String pref;
|
private final String pref;
|
||||||
private final QuestFactory questFactory;
|
private final QuestFactory questFactory;
|
||||||
private boolean hasObjective = false;
|
private boolean hasObjective = false;
|
||||||
private final int size = 17;
|
private final int size = 16;
|
||||||
|
|
||||||
public StageMainPrompt(Quests plugin, int stageNum, QuestFactory qf) {
|
public StageMainPrompt(Quests plugin, int stageNum, QuestFactory qf) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@ -94,16 +94,6 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
return ChatColor.BLUE;
|
return ChatColor.BLUE;
|
||||||
}
|
}
|
||||||
case 12:
|
case 12:
|
||||||
if (plugin.getDependencies().getDenizenAPI() == null) {
|
|
||||||
return ChatColor.GRAY;
|
|
||||||
} else {
|
|
||||||
if (!hasObjective) {
|
|
||||||
return ChatColor.GRAY;
|
|
||||||
} else {
|
|
||||||
return ChatColor.BLUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case 13:
|
|
||||||
if (context.getSessionData(pref + CK.S_START_MESSAGE) == null) {
|
if (context.getSessionData(pref + CK.S_START_MESSAGE) == null) {
|
||||||
if (!hasObjective) {
|
if (!hasObjective) {
|
||||||
return ChatColor.GRAY;
|
return ChatColor.GRAY;
|
||||||
@ -113,7 +103,7 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
} else {
|
} else {
|
||||||
return ChatColor.BLUE;
|
return ChatColor.BLUE;
|
||||||
}
|
}
|
||||||
case 14:
|
case 13:
|
||||||
if (context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) == null) {
|
if (context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) == null) {
|
||||||
if (!hasObjective) {
|
if (!hasObjective) {
|
||||||
return ChatColor.GRAY;
|
return ChatColor.GRAY;
|
||||||
@ -123,7 +113,7 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
} else {
|
} else {
|
||||||
return ChatColor.BLUE;
|
return ChatColor.BLUE;
|
||||||
}
|
}
|
||||||
case 15:
|
case 14:
|
||||||
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) == null) {
|
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) == null) {
|
||||||
if (!hasObjective) {
|
if (!hasObjective) {
|
||||||
return ChatColor.GRAY;
|
return ChatColor.GRAY;
|
||||||
@ -133,14 +123,15 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
} else {
|
} else {
|
||||||
return ChatColor.BLUE;
|
return ChatColor.BLUE;
|
||||||
}
|
}
|
||||||
case 16:
|
case 15:
|
||||||
return ChatColor.RED;
|
return ChatColor.RED;
|
||||||
case 17:
|
case 16:
|
||||||
return ChatColor.GREEN;
|
return ChatColor.GREEN;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSelectionText(ConversationContext context, int number) {
|
public String getSelectionText(ConversationContext context, int number) {
|
||||||
switch (number) {
|
switch (number) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -178,16 +169,6 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
return ChatColor.YELLOW + Lang.get("stageEditorDelayMessage");
|
return ChatColor.YELLOW + Lang.get("stageEditorDelayMessage");
|
||||||
}
|
}
|
||||||
case 12:
|
case 12:
|
||||||
if (plugin.getDependencies().getDenizenAPI() == null) {
|
|
||||||
return ChatColor.GRAY + Lang.get("stageEditorDenizenScript");
|
|
||||||
} else {
|
|
||||||
if (!hasObjective) {
|
|
||||||
return ChatColor.GRAY + Lang.get("stageEditorDenizenScript");
|
|
||||||
} else {
|
|
||||||
return ChatColor.YELLOW + Lang.get("stageEditorDenizenScript");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case 13:
|
|
||||||
if (context.getSessionData(pref + CK.S_START_MESSAGE) == null) {
|
if (context.getSessionData(pref + CK.S_START_MESSAGE) == null) {
|
||||||
if (!hasObjective) {
|
if (!hasObjective) {
|
||||||
return ChatColor.GRAY + Lang.get("stageEditorStartMessage");
|
return ChatColor.GRAY + Lang.get("stageEditorStartMessage");
|
||||||
@ -197,7 +178,7 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
} else {
|
} else {
|
||||||
return ChatColor.YELLOW + Lang.get("stageEditorStartMessage");
|
return ChatColor.YELLOW + Lang.get("stageEditorStartMessage");
|
||||||
}
|
}
|
||||||
case 14:
|
case 13:
|
||||||
if (context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) == null) {
|
if (context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) == null) {
|
||||||
if (!hasObjective) {
|
if (!hasObjective) {
|
||||||
return ChatColor.GRAY + Lang.get("stageEditorCompleteMessage");
|
return ChatColor.GRAY + Lang.get("stageEditorCompleteMessage");
|
||||||
@ -207,7 +188,7 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
} else {
|
} else {
|
||||||
return ChatColor.YELLOW + Lang.get("stageEditorCompleteMessage");
|
return ChatColor.YELLOW + Lang.get("stageEditorCompleteMessage");
|
||||||
}
|
}
|
||||||
case 15:
|
case 14:
|
||||||
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) == null) {
|
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) == null) {
|
||||||
if (!hasObjective) {
|
if (!hasObjective) {
|
||||||
return ChatColor.GRAY + Lang.get("stageEditorObjectiveOverride");
|
return ChatColor.GRAY + Lang.get("stageEditorObjectiveOverride");
|
||||||
@ -217,9 +198,9 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
} else {
|
} else {
|
||||||
return ChatColor.YELLOW + Lang.get("stageEditorObjectiveOverride");
|
return ChatColor.YELLOW + Lang.get("stageEditorObjectiveOverride");
|
||||||
}
|
}
|
||||||
case 16:
|
case 15:
|
||||||
return ChatColor.RED + Lang.get("stageEditorDelete");
|
return ChatColor.RED + Lang.get("stageEditorDelete");
|
||||||
case 17:
|
case 16:
|
||||||
return ChatColor.GREEN + Lang.get("done");
|
return ChatColor.GREEN + Lang.get("done");
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@ -341,21 +322,6 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
+ context.getSessionData(pref + CK.S_DELAY_MESSAGE) + "\"" + ChatColor.GRAY + ")";
|
+ context.getSessionData(pref + CK.S_DELAY_MESSAGE) + "\"" + ChatColor.GRAY + ")";
|
||||||
}
|
}
|
||||||
case 12:
|
case 12:
|
||||||
if (plugin.getDependencies().getDenizenAPI() == null) {
|
|
||||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
|
||||||
} else {
|
|
||||||
if (!hasObjective) {
|
|
||||||
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
|
|
||||||
} else {
|
|
||||||
if (context.getSessionData(pref + CK.S_DENIZEN) == null) {
|
|
||||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
|
||||||
} else {
|
|
||||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(pref + CK.S_DENIZEN)
|
|
||||||
+ ChatColor.GRAY + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case 13:
|
|
||||||
if (context.getSessionData(pref + CK.S_START_MESSAGE) == null) {
|
if (context.getSessionData(pref + CK.S_START_MESSAGE) == null) {
|
||||||
if (!hasObjective) {
|
if (!hasObjective) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
|
||||||
@ -366,7 +332,7 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\""
|
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\""
|
||||||
+ context.getSessionData(pref + CK.S_START_MESSAGE) + "\"" + ChatColor.GRAY + ")";
|
+ context.getSessionData(pref + CK.S_START_MESSAGE) + "\"" + ChatColor.GRAY + ")";
|
||||||
}
|
}
|
||||||
case 14:
|
case 13:
|
||||||
if (context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) == null) {
|
if (context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) == null) {
|
||||||
if (!hasObjective) {
|
if (!hasObjective) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
|
||||||
@ -377,7 +343,7 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\""
|
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\""
|
||||||
+ context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) + "\"" + ChatColor.GRAY + ")";
|
+ context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) + "\"" + ChatColor.GRAY + ")";
|
||||||
}
|
}
|
||||||
case 15:
|
case 14:
|
||||||
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) == null) {
|
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) == null) {
|
||||||
if (!hasObjective) {
|
if (!hasObjective) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
|
||||||
@ -388,8 +354,8 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\""
|
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\""
|
||||||
+ context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) + "\"" + ChatColor.GRAY + ")";
|
+ context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) + "\"" + ChatColor.GRAY + ")";
|
||||||
}
|
}
|
||||||
|
case 15:
|
||||||
case 16:
|
case 16:
|
||||||
case 17:
|
|
||||||
return "";
|
return "";
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@ -454,7 +420,7 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
} else {
|
} else {
|
||||||
return new DelayMessagePrompt();
|
return new DelayMessagePrompt();
|
||||||
}
|
}
|
||||||
case 12:
|
/*case 12:
|
||||||
if (plugin.getDependencies().getDenizenAPI() == null) {
|
if (plugin.getDependencies().getDenizenAPI() == null) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDenizen"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDenizen"));
|
||||||
return new StageMainPrompt(plugin, stageNum, questFactory);
|
return new StageMainPrompt(plugin, stageNum, questFactory);
|
||||||
@ -465,31 +431,31 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new StageMainPrompt(plugin, stageNum, questFactory);
|
return new StageMainPrompt(plugin, stageNum, questFactory);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
case 13:
|
case 12:
|
||||||
if (hasObjective) {
|
if (hasObjective) {
|
||||||
return new StartMessagePrompt();
|
return new StartMessagePrompt();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new StageMainPrompt(plugin, stageNum, questFactory);
|
return new StageMainPrompt(plugin, stageNum, questFactory);
|
||||||
}
|
}
|
||||||
case 14:
|
case 13:
|
||||||
if (hasObjective) {
|
if (hasObjective) {
|
||||||
return new CompleteMessagePrompt();
|
return new CompleteMessagePrompt();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new StageMainPrompt(plugin, stageNum, questFactory);
|
return new StageMainPrompt(plugin, stageNum, questFactory);
|
||||||
}
|
}
|
||||||
case 15:
|
case 14:
|
||||||
if (hasObjective) {
|
if (hasObjective) {
|
||||||
return new OverrideDisplayPrompt();
|
return new OverrideDisplayPrompt();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new StageMainPrompt(plugin, stageNum, questFactory);
|
return new StageMainPrompt(plugin, stageNum, questFactory);
|
||||||
}
|
}
|
||||||
case 16:
|
case 15:
|
||||||
return new DeletePrompt();
|
return new DeletePrompt();
|
||||||
case 17:
|
case 16:
|
||||||
return new StageMenuPrompt(plugin, questFactory);
|
return new StageMenuPrompt(plugin, questFactory);
|
||||||
default:
|
default:
|
||||||
return new StageMainPrompt(plugin, stageNum, questFactory);
|
return new StageMainPrompt(plugin, stageNum, questFactory);
|
||||||
@ -1500,39 +1466,6 @@ public class StageMainPrompt extends NumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DenizenPrompt extends StringPrompt {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPromptText(ConversationContext context) {
|
|
||||||
String text = ChatColor.DARK_AQUA + "- " + Lang.get("stageEditorDenizenScript") + " -\n";
|
|
||||||
for (String s : plugin.getDependencies().getDenizenAPI()._getScriptNames()) {
|
|
||||||
text += ChatColor.AQUA + "- " + s + "\n";
|
|
||||||
}
|
|
||||||
return text + ChatColor.YELLOW + Lang.get("stageEditorScriptPrompt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
|
||||||
Player player = (Player) context.getForWhom();
|
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
|
||||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
|
||||||
if (plugin.getDependencies().getDenizenAPI().containsScript(input)) {
|
|
||||||
context.setSessionData(pref + CK.S_DENIZEN, input.toUpperCase());
|
|
||||||
return new StageMainPrompt(plugin, stageNum, questFactory);
|
|
||||||
} else {
|
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidScript"));
|
|
||||||
return new DenizenPrompt();
|
|
||||||
}
|
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
|
||||||
context.setSessionData(pref + CK.S_DENIZEN, null);
|
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDenizenCleared"));
|
|
||||||
return new StageMainPrompt(plugin, stageNum, questFactory);
|
|
||||||
} else {
|
|
||||||
return new StageMainPrompt(plugin, stageNum, questFactory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class DeletePrompt extends StringPrompt {
|
private class DeletePrompt extends StringPrompt {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,8 +48,8 @@ public class StageTimer implements Runnable {
|
|||||||
if (quester.getCurrentStage(quest).getScript() != null) {
|
if (quester.getCurrentStage(quest).getScript() != null) {
|
||||||
plugin.getDependencies().runDenizenScript(quester.getCurrentStage(quest).getScript(), quester);
|
plugin.getDependencies().runDenizenScript(quester.getCurrentStage(quest).getScript(), quester);
|
||||||
}
|
}
|
||||||
if (quester.getCurrentStage(quest).getFinishEvent() != null) {
|
if (quester.getCurrentStage(quest).getFinishAction() != null) {
|
||||||
quester.getCurrentStage(quest).getFinishEvent().fire(quester, quest);
|
quester.getCurrentStage(quest).getFinishAction().fire(quester, quest);
|
||||||
}
|
}
|
||||||
quest.completeQuest(quester);
|
quest.completeQuest(quester);
|
||||||
} else {
|
} else {
|
||||||
@ -59,8 +59,8 @@ public class StageTimer implements Runnable {
|
|||||||
if (currentStage.getScript() != null) {
|
if (currentStage.getScript() != null) {
|
||||||
plugin.getDependencies().runDenizenScript(currentStage.getScript(), quester);
|
plugin.getDependencies().runDenizenScript(currentStage.getScript(), quester);
|
||||||
}
|
}
|
||||||
if (currentStage.getFinishEvent() != null) {
|
if (currentStage.getFinishAction() != null) {
|
||||||
currentStage.getFinishEvent().fire(quester, quest);
|
currentStage.getFinishAction().fire(quester, quest);
|
||||||
}
|
}
|
||||||
quester.hardStagePut(quest, stageNum);
|
quester.hardStagePut(quest, stageNum);
|
||||||
quester.addEmptiesFor(quest, stageNum);
|
quester.addEmptiesFor(quest, stageNum);
|
||||||
@ -68,7 +68,7 @@ public class StageTimer implements Runnable {
|
|||||||
//quester.getCurrentStage(quest).setDelay(-1);
|
//quester.getCurrentStage(quest).setDelay(-1);
|
||||||
quester.getQuestData(quest).delayStartTime = 0;
|
quester.getQuestData(quest).delayStartTime = 0;
|
||||||
quester.getQuestData(quest).delayTimeLeft = -1;
|
quester.getQuestData(quest).delayTimeLeft = -1;
|
||||||
Action stageStartEvent = quester.getCurrentStage(quest).getStartEvent();
|
Action stageStartEvent = quester.getCurrentStage(quest).getStartAction();
|
||||||
if (stageStartEvent != null) {
|
if (stageStartEvent != null) {
|
||||||
stageStartEvent.fire(quester, quest);
|
stageStartEvent.fire(quester, quest);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class CK {
|
|||||||
public static final String S_DISCONNECT_EVENT = "disconnectEvent";
|
public static final String S_DISCONNECT_EVENT = "disconnectEvent";
|
||||||
public static final String S_DELAY = "delay";
|
public static final String S_DELAY = "delay";
|
||||||
public static final String S_DELAY_MESSAGE = "delayMessage";
|
public static final String S_DELAY_MESSAGE = "delayMessage";
|
||||||
public static final String S_DENIZEN = "denizen";
|
public static final String S_DENIZEN = "denizen"; // Legacy
|
||||||
public static final String S_COMPLETE_MESSAGE = "completeMessage";
|
public static final String S_COMPLETE_MESSAGE = "completeMessage";
|
||||||
public static final String S_START_MESSAGE = "startMessage";
|
public static final String S_START_MESSAGE = "startMessage";
|
||||||
public static final String S_OVERRIDE_DISPLAY = "overrideDisplay";
|
public static final String S_OVERRIDE_DISPLAY = "overrideDisplay";
|
||||||
@ -165,4 +165,5 @@ public class CK {
|
|||||||
public static final String E_COMMANDS = "evtCommands";
|
public static final String E_COMMANDS = "evtCommands";
|
||||||
public static final String E_TIMER = "evtTimer";
|
public static final String E_TIMER = "evtTimer";
|
||||||
public static final String E_CANCEL_TIMER = "evtCancelTimer";
|
public static final String E_CANCEL_TIMER = "evtCancelTimer";
|
||||||
|
public static final String E_DENIZEN = "evtDenizen";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user