Extended Event System

Also updated libraries
This commit is contained in:
Blackvein 2013-09-20 20:08:37 -07:00
parent 2bc36ba2cc
commit 8cb9ea0963
16 changed files with 465 additions and 97 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId> <groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId> <artifactId>quests</artifactId>
<version>1.6.7-SNAPSHOT</version> <version>1.6.8-SNAPSHOT</version>
<name>quests</name> <name>quests</name>
<url>http://dev.bukkit.org/server-mods/quests/</url> <url>http://dev.bukkit.org/server-mods/quests/</url>
<packaging>jar</packaging> <packaging>jar</packaging>
@ -47,7 +47,7 @@
<dependency> <dependency>
<groupId>net.aufdemrand</groupId> <groupId>net.aufdemrand</groupId>
<artifactId>denizen</artifactId> <artifactId>denizen</artifactId>
<version>0.9.1-SNAPSHOT</version> <version>0.9.2-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.milkbowl.vault</groupId> <groupId>net.milkbowl.vault</groupId>

View File

@ -1,7 +1,7 @@
package me.blackvein.quests; package me.blackvein.quests;
import net.minecraft.server.v1_6_R2.Packet; import net.minecraft.server.v1_6_R3.Packet;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class PacketUtils { public class PacketUtils {

View File

@ -1,10 +1,9 @@
package me.blackvein.quests; package me.blackvein.quests;
import me.blackvein.quests.util.ReflectionUtil; import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_6_R2.Packet63WorldParticles; import net.minecraft.server.v1_6_R3.Packet63WorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public enum ParticleEffect { public enum ParticleEffect {

View File

@ -6,7 +6,6 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import me.blackvein.quests.prompts.RequirementsPrompt; import me.blackvein.quests.prompts.RequirementsPrompt;
import me.blackvein.quests.prompts.RewardsPrompt; import me.blackvein.quests.prompts.RewardsPrompt;
import me.blackvein.quests.prompts.StagesPrompt; import me.blackvein.quests.prompts.StagesPrompt;
@ -14,7 +13,6 @@ import me.blackvein.quests.util.CK;
import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang; import me.blackvein.quests.util.Lang;
import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -974,7 +972,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
cs.set("redo-delay", redo); cs.set("redo-delay", redo);
cs.set("ask-message", desc); cs.set("ask-message", desc);
cs.set("finish-message", finish); cs.set("finish-message", finish);
cs.set(CK.S_EVENT, initialEvent); cs.set(CK.S_FINISH_EVENT, initialEvent);
if (moneyReq != null || questPointsReq != null || itemReqs != null && itemReqs.isEmpty() == false || permReqs != null && permReqs.isEmpty() == false || (questReqs != null && questReqs.isEmpty() == false) || (questBlocks != null && questBlocks.isEmpty() == false)) { if (moneyReq != null || questPointsReq != null || itemReqs != null && itemReqs.isEmpty() == false || permReqs != null && permReqs.isEmpty() == false || (questReqs != null && questReqs.isEmpty() == false) || (questBlocks != null && questBlocks.isEmpty() == false)) {
@ -1059,7 +1057,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
LinkedList<Integer> shearAmounts; LinkedList<Integer> shearAmounts;
String script; String script;
String event; String startEvent;
String finishEvent;
String deathEvent;
String disconnectEvent;
LinkedList<String> chatEvents;
LinkedList<String> chatEventTriggers;
Long delay; Long delay;
String delayMessage; String delayMessage;
String startMessage; String startMessage;
@ -1121,7 +1124,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
shearAmounts = null; shearAmounts = null;
script = null; script = null;
event = null; startEvent = null;
finishEvent = null;
deathEvent = null;
disconnectEvent = null;
chatEvents = null;
chatEventTriggers = null;
delay = null; delay = null;
delayMessage = null; delayMessage = null;
startMessage = null; startMessage = null;
@ -1212,8 +1220,25 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
shearAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_SHEAR_AMOUNTS); shearAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_SHEAR_AMOUNTS);
} }
if (cc.getSessionData(pref + CK.S_EVENT) != null) { if (cc.getSessionData(pref + CK.S_START_EVENT) != null) {
event = (String) cc.getSessionData(pref + CK.S_EVENT); startEvent = (String) cc.getSessionData(pref + CK.S_START_EVENT);
}
if (cc.getSessionData(pref + CK.S_FINISH_EVENT) != null) {
finishEvent = (String) cc.getSessionData(pref + CK.S_FINISH_EVENT);
}
if (cc.getSessionData(pref + CK.S_DEATH_EVENT) != null) {
deathEvent = (String) cc.getSessionData(pref + CK.S_DEATH_EVENT);
}
if (cc.getSessionData(pref + CK.S_DISCONNECT_EVENT) != null) {
disconnectEvent = (String) cc.getSessionData(pref + CK.S_DISCONNECT_EVENT);
}
if (cc.getSessionData(pref + CK.S_CHAT_EVENTS) != null) {
chatEvents = (LinkedList<String>) cc.getSessionData(pref + CK.S_CHAT_EVENTS);
chatEventTriggers = (LinkedList<String>) cc.getSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS);
} }
if (cc.getSessionData(pref + CK.S_DELAY) != null) { if (cc.getSessionData(pref + CK.S_DELAY) != null) {
@ -1291,7 +1316,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
stage.set("sheep-to-shear", shearColors); stage.set("sheep-to-shear", shearColors);
stage.set("sheep-amounts", shearAmounts); stage.set("sheep-amounts", shearAmounts);
stage.set("script-to-run", script); stage.set("script-to-run", script);
stage.set("event", event); stage.set("start-event", startEvent);
stage.set("finish-event", finishEvent);
stage.set("death-event", deathEvent);
stage.set("disconnect-event", disconnectEvent);
stage.set("chat-events", chatEvents);
stage.set("chat-event-triggers", chatEventTriggers);
stage.set("delay", delay); stage.set("delay", delay);
stage.set("delay-message", delayMessage); stage.set("delay-message", delayMessage);
stage.set("start-message", startMessage); stage.set("start-message", startMessage);
@ -1651,8 +1681,33 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
} }
if (stage.startEvent != null) {
cc.setSessionData(pref + CK.S_START_EVENT, stage.startEvent.getName());
}
if (stage.finishEvent != null) { if (stage.finishEvent != null) {
cc.setSessionData(pref + CK.S_EVENT, stage.finishEvent.getName()); cc.setSessionData(pref + CK.S_FINISH_EVENT, stage.finishEvent.getName());
}
if (stage.deathEvent != null) {
cc.setSessionData(pref + CK.S_DEATH_EVENT, stage.deathEvent.getName());
}
if (stage.disconnectEvent != null) {
cc.setSessionData(pref + CK.S_DISCONNECT_EVENT, stage.disconnectEvent.getName());
}
if (stage.chatEvents != null) {
LinkedList<String> chatEvents = new LinkedList<String>();
LinkedList<String> chatEventTriggers = new LinkedList<String>();
for(String s : stage.chatEvents.keySet()){
chatEventTriggers.add(s);
chatEvents.add(stage.chatEvents.get(s).getName());
}
cc.setSessionData(pref + CK.S_CHAT_EVENTS, chatEvents);
cc.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers);
} }

View File

@ -5,7 +5,6 @@ import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.logging.Level; import java.util.logging.Level;
import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.ItemUtil;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
@ -1208,9 +1207,6 @@ public class Quester {
public void addEmpties() { public void addEmpties() {
System.out.println("Adding empties.");
System.out.println("Citizens to kill: " + currentStage.citizensToKill.size());
if (currentStage.blocksToDamage.isEmpty() == false) { if (currentStage.blocksToDamage.isEmpty() == false) {
for (Material m : currentStage.blocksToDamage.keySet()) { for (Material m : currentStage.blocksToDamage.keySet()) {
@ -1298,7 +1294,6 @@ public class Quester {
if (currentStage.citizensToKill.isEmpty() == false) { if (currentStage.citizensToKill.isEmpty() == false) {
for (Integer n : currentStage.citizensToKill) { for (Integer n : currentStage.citizensToKill) {
System.out.println("Adding..");
citizensKilled.add(n); citizensKilled.add(n);
citizenNumKilled.add(0); citizenNumKilled.add(0);

View File

@ -42,7 +42,6 @@ public class StageTimer implements Runnable{
quester.currentStage.finishEvent.fire(quester); quester.currentStage.finishEvent.fire(quester);
quester.currentStage = quester.currentQuest.stages.get(quester.currentStageIndex + 1); quester.currentStage = quester.currentQuest.stages.get(quester.currentStageIndex + 1);
quester.currentStageIndex++; quester.currentStageIndex++;
System.out.println("Adding empties from stage timer");
quester.addEmpties(); quester.addEmpties();
quester.delayStartTime = 0; quester.delayStartTime = 0;
quester.delayTimeLeft = -1; quester.delayTimeLeft = -1;

View File

@ -3,7 +3,6 @@ package me.blackvein.quests.prompts;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import me.ThaH3lper.com.LoadBosses.LoadBoss; import me.ThaH3lper.com.LoadBosses.LoadBoss;
import me.blackvein.quests.ColorUtil; import me.blackvein.quests.ColorUtil;
import me.blackvein.quests.Event; import me.blackvein.quests.Event;
@ -15,7 +14,6 @@ import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang; import me.blackvein.quests.util.Lang;
import net.aufdemrand.denizen.scripts.ScriptRegistry; import net.aufdemrand.denizen.scripts.ScriptRegistry;
import net.citizensnpcs.api.CitizensPlugin; import net.citizensnpcs.api.CitizensPlugin;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -309,11 +307,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
if (context.getSessionData(pref + CK.S_EVENT) == null) { text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- " + Lang.get("stageEditorEvents") + "\n";
text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- " + Lang.get("stageEditorEvents") + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- " + Lang.get("stageEditorEvents") + GRAY + " (" + AQUA + context.getSessionData(pref + CK.S_EVENT) + GRAY + ")\n";
}
if (context.getSessionData(pref + CK.S_DELAY) == null) { if (context.getSessionData(pref + CK.S_DELAY) == null) {
text += PINK + "" + BOLD + "18 " + RESET + PURPLE + "- " + Lang.get("delay") + GRAY + " (" + Lang.get("noneSet") + ")\n"; text += PINK + "" + BOLD + "18 " + RESET + PURPLE + "- " + Lang.get("delay") + GRAY + " (" + Lang.get("noneSet") + ")\n";
@ -418,7 +412,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} else if (input.equalsIgnoreCase("16")) { } else if (input.equalsIgnoreCase("16")) {
return new ShearListPrompt(); return new ShearListPrompt();
} else if (input.equalsIgnoreCase("17")) { } else if (input.equalsIgnoreCase("17")) {
return new EventsPrompt(); return new EventListPrompt();
} else if (input.equalsIgnoreCase("18")) { } else if (input.equalsIgnoreCase("18")) {
return new DelayPrompt(); return new DelayPrompt();
} else if (input.equalsIgnoreCase("19")) { } else if (input.equalsIgnoreCase("19")) {
@ -3367,73 +3361,94 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
} }
private class EventsPrompt extends FixedSetPrompt { private class EventListPrompt extends FixedSetPrompt {
public EventsPrompt(){ public EventListPrompt(){
super("1", "2", "3", "4"); super("1", "2", "3", "4", "5", "6");
} }
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = DARKGREEN + "- " + Lang.get("stageEditorEvents") + " -\n"; String text = GREEN + "- " + Lang.get("stageEditorStageEvents") + " -\n";
if (questFactory.quests.events.isEmpty()) {
text += RED + "- None"; if(context.getSessionData(pref + CK.S_START_EVENT) == null)
} else { text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorStartEvent") + " (" + Lang.get("noneSet") + ")\n";
for (Event e : questFactory.quests.events) { else
text += GREEN + "- " + e.getName() + "\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorStartEvent") + " (" + AQUA + ((String) context.getSessionData(pref + CK.S_START_EVENT)) + YELLOW + ")\n";
}
if(context.getSessionData(pref + CK.S_FINISH_EVENT) == null)
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorFinishEvent") + " (" + Lang.get("noneSet") + ")\n";
else
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorFinishEvent") + " (" + AQUA + ((String) context.getSessionData(pref + CK.S_FINISH_EVENT)) + YELLOW + ")\n";
if(context.getSessionData(pref + CK.S_DEATH_EVENT) == null)
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorDeathEvent") + " (" + Lang.get("noneSet") + ")\n";
else
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorDeathEvent") + " (" + AQUA + ((String) context.getSessionData(pref + CK.S_DEATH_EVENT)) + YELLOW + ")\n";
if(context.getSessionData(pref + CK.S_DISCONNECT_EVENT) == null)
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("stageEditorDisconnectEvent") + " (" + Lang.get("noneSet") + ")\n";
else
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("stageEditorDisconnectEvent") + " (" + AQUA + ((String) context.getSessionData(pref + CK.S_DISCONNECT_EVENT)) + YELLOW + ")\n";
if(context.getSessionData(pref + CK.S_CHAT_EVENTS) == null)
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("stageEditorChatEvents") + " (" + Lang.get("noneSet") + ")\n";
else{
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("stageEditorChatEvents") + "\n";
LinkedList<String> chatEvents = (LinkedList<String>) context.getSessionData(pref + CK.S_CHAT_EVENTS);
LinkedList<String> chatEventTriggers = (LinkedList<String>) context.getSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS);
for(String event : chatEvents)
text += AQUA + " - " + event + BLUE + " (" + Lang.get("stageEditorTriggeredBy") + ": \"" + chatEventTriggers.get(chatEvents.indexOf(event)) + "\")\n";
} }
return text + YELLOW + Lang.get("stageEditorEventsPrompt"); text += BLUE + "" + BOLD + "6" + RESET + BLUE + " - " + Lang.get("back");
return text;
} }
/*
en.put("stageEditorStageEvents", "Stage Events");
en.put("stageEditorStartEvent", "Start Event");
en.put("stageEditorFinishEvent", "Finish Event");
en.put("stageEditorChatEvents", "Chat Events");
en.put("stageEditorDeathEvent", "Death Event");
en.put("stageEditorDisconnectEvent", "Disconnect Event");
*/
@Override @Override
public Prompt acceptValidatedInput(ConversationContext context, String input) { protected Prompt acceptValidatedInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom(); if(input.equalsIgnoreCase("1"))
return new StartEventPrompt();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { else if(input.equalsIgnoreCase("2"))
return new FinishEventPrompt();
Event found = null; else if(input.equalsIgnoreCase("3"))
return new DeathEventPrompt();
for (Event e : questFactory.quests.events) { else if(input.equalsIgnoreCase("4"))
return new DisconnectEventPrompt();
if (e.getName().equalsIgnoreCase(input)) { else if(input.equalsIgnoreCase("5"))
found = e; return new ChatEventPrompt();
break; else if(input.equalsIgnoreCase("6"))
}
}
if (found == null) {
player.sendMessage(RED + input + YELLOW + " " + Lang.get("stageEditorInvalidEvent"));
return new EventsPrompt();
} else {
context.setSessionData(pref + CK.S_EVENT, found.getName());
return new CreateStagePrompt(stageNum, questFactory, citizens);
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_EVENT, null);
player.sendMessage(YELLOW + "Event cleared.");
return new CreateStagePrompt(stageNum, questFactory, citizens); return new CreateStagePrompt(stageNum, questFactory, citizens);
} else { else
return new CreateStagePrompt(stageNum, questFactory, citizens); return new EventListPrompt();
}
} }
} }
private class EventPrompt extends StringPrompt { private class StartEventPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = DARKGREEN + "- " + Lang.get("stageEditorEvents") + " -\n"; String text = DARKGREEN + "- " + Lang.get("stageEditorStartEvent") + " -\n";
if (questFactory.quests.events.isEmpty()) { if (questFactory.quests.events.isEmpty()) {
text += RED + "- None"; text += RED + "- None";
} else { } else {
@ -3466,18 +3481,308 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if (found == null) { if (found == null) {
player.sendMessage(RED + input + YELLOW + " " + Lang.get("stageEditorInvalidEvent")); player.sendMessage(RED + input + YELLOW + " " + Lang.get("stageEditorInvalidEvent"));
return new EventPrompt(); return new StartEventPrompt();
} else { } else {
context.setSessionData(pref + CK.S_EVENT, found.getName()); context.setSessionData(pref + CK.S_START_EVENT, found.getName());
return new CreateStagePrompt(stageNum, questFactory, citizens); return new EventListPrompt();
} }
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_EVENT, null); context.setSessionData(pref + CK.S_START_EVENT, null);
player.sendMessage(YELLOW + "Event cleared."); player.sendMessage(YELLOW + Lang.get("stageEditorStartEventCleared"));
return new CreateStagePrompt(stageNum, questFactory, citizens); return new EventListPrompt();
} else { } else {
return new CreateStagePrompt(stageNum, questFactory, citizens); return new StartEventPrompt();
}
}
}
private class FinishEventPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
String text = DARKGREEN + "- " + Lang.get("stageEditorFinishEvent") + " -\n";
if (questFactory.quests.events.isEmpty()) {
text += RED + "- None";
} else {
for (Event e : questFactory.quests.events) {
text += GREEN + "- " + e.getName() + "\n";
}
}
return text + YELLOW + Lang.get("stageEditorEventsPrompt");
}
@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) {
Event found = null;
for (Event e : questFactory.quests.events) {
if (e.getName().equalsIgnoreCase(input)) {
found = e;
break;
}
}
if (found == null) {
player.sendMessage(RED + input + YELLOW + " " + Lang.get("stageEditorInvalidEvent"));
return new FinishEventPrompt();
} else {
context.setSessionData(pref + CK.S_FINISH_EVENT, found.getName());
return new EventListPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_FINISH_EVENT, null);
player.sendMessage(YELLOW + Lang.get("stageEditorFinishEventCleared"));
return new EventListPrompt();
} else {
return new FinishEventPrompt();
}
}
}
private class DeathEventPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
String text = DARKGREEN + "- " + Lang.get("stageEditorDeathEvent") + " -\n";
if (questFactory.quests.events.isEmpty()) {
text += RED + "- None";
} else {
for (Event e : questFactory.quests.events) {
text += GREEN + "- " + e.getName() + "\n";
}
}
return text + YELLOW + Lang.get("stageEditorEventsPrompt");
}
@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) {
Event found = null;
for (Event e : questFactory.quests.events) {
if (e.getName().equalsIgnoreCase(input)) {
found = e;
break;
}
}
if (found == null) {
player.sendMessage(RED + input + YELLOW + " " + Lang.get("stageEditorInvalidEvent"));
return new DeathEventPrompt();
} else {
context.setSessionData(pref + CK.S_DEATH_EVENT, found.getName());
return new EventListPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_DEATH_EVENT, null);
player.sendMessage(YELLOW + Lang.get("stageEditorDeathEventCleared"));
return new EventListPrompt();
} else {
return new DeathEventPrompt();
}
}
}
private class DisconnectEventPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
String text = DARKGREEN + "- " + Lang.get("stageEditorDisconnectEvent") + " -\n";
if (questFactory.quests.events.isEmpty()) {
text += RED + "- None";
} else {
for (Event e : questFactory.quests.events) {
text += GREEN + "- " + e.getName() + "\n";
}
}
return text + YELLOW + Lang.get("stageEditorEventsPrompt");
}
@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) {
Event found = null;
for (Event e : questFactory.quests.events) {
if (e.getName().equalsIgnoreCase(input)) {
found = e;
break;
}
}
if (found == null) {
player.sendMessage(RED + input + YELLOW + " " + Lang.get("stageEditorInvalidEvent"));
return new DisconnectEventPrompt();
} else {
context.setSessionData(pref + CK.S_DISCONNECT_EVENT, found.getName());
return new EventListPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_DISCONNECT_EVENT, null);
player.sendMessage(YELLOW + Lang.get("stageEditorDisconnectEventCleared"));
return new EventListPrompt();
} else {
return new DisconnectEventPrompt();
}
}
}
private class ChatEventPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
String text = DARKGREEN + "- " + Lang.get("stageEditorChatEvents") + " -\n";
if (questFactory.quests.events.isEmpty()) {
text += RED + "- None";
} else {
for (Event e : questFactory.quests.events) {
text += GREEN + "- " + e.getName() + "\n";
}
}
return text + YELLOW + Lang.get("stageEditorChatEventsPrompt");
}
@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) {
Event found = null;
for (Event e : questFactory.quests.events) {
if (e.getName().equalsIgnoreCase(input)) {
found = e;
break;
}
}
if (found == null) {
player.sendMessage(RED + input + YELLOW + " " + Lang.get("stageEditorInvalidEvent"));
return new ChatEventPrompt();
} else {
context.setSessionData(pref + CK.S_CHAT_TEMP_EVENT, found.getName());
return new ChatEventTriggerPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_CHAT_EVENTS, null);
context.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, null);
player.sendMessage(YELLOW + Lang.get("stageEditorChatEventsCleared"));
return new EventListPrompt();
} else {
return new ChatEventPrompt();
}
}
}
private class ChatEventTriggerPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
String tempEvent = (String) context.getSessionData(pref + CK.S_CHAT_TEMP_EVENT);
String text = GOLD + "- " + Lang.get("stageEditorChatTrigger") + " -\n";
text += YELLOW + Lang.get("stageEditorChatEventsTriggerPromptA") + " " + AQUA + tempEvent + " " + YELLOW + Lang.get("stageEditorChatEventsTriggerPromptB");
return text;
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if(context.getSessionData(pref + CK.S_CHAT_EVENTS) == null){
LinkedList<String> chatEvents = new LinkedList<String>();
LinkedList<String> chatEventTriggers = new LinkedList<String>();
String event = (String) context.getSessionData(pref + CK.S_CHAT_TEMP_EVENT);
chatEvents.add(event);
chatEventTriggers.add(input.trim());
context.setSessionData(pref + CK.S_CHAT_EVENTS, chatEvents);
context.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers);
return new EventListPrompt();
}else {
LinkedList<String> chatEvents = (LinkedList<String>) context.getSessionData(pref + CK.S_CHAT_EVENTS);
LinkedList<String> chatEventTriggers = (LinkedList<String>) context.getSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS);
String event = (String) context.getSessionData(pref + CK.S_CHAT_TEMP_EVENT);
chatEvents.add(event);
chatEventTriggers.add(input.trim());
context.setSessionData(pref + CK.S_CHAT_EVENTS, chatEvents);
context.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers);
return new EventListPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt();
} else {
return new ChatEventTriggerPrompt();
} }
} }

View File

@ -156,7 +156,7 @@ public class StagesPrompt extends StringPrompt implements ColorUtil{
cc.setSessionData(newPref + CK.S_SHEAR_COLORS, cc.getSessionData(pref + CK.S_SHEAR_COLORS)); cc.setSessionData(newPref + CK.S_SHEAR_COLORS, cc.getSessionData(pref + CK.S_SHEAR_COLORS));
cc.setSessionData(newPref + CK.S_SHEAR_AMOUNTS, cc.getSessionData(pref + CK.S_SHEAR_AMOUNTS)); cc.setSessionData(newPref + CK.S_SHEAR_AMOUNTS, cc.getSessionData(pref + CK.S_SHEAR_AMOUNTS));
cc.setSessionData(newPref + CK.S_EVENT, cc.getSessionData(pref + CK.S_EVENT)); cc.setSessionData(newPref + CK.S_FINISH_EVENT, cc.getSessionData(pref + CK.S_FINISH_EVENT));
cc.setSessionData(newPref + CK.S_DELAY, cc.getSessionData(pref + CK.S_DELAY)); cc.setSessionData(newPref + CK.S_DELAY, cc.getSessionData(pref + CK.S_DELAY));
cc.setSessionData(newPref +CK.S_DELAY_MESSAGE, cc.getSessionData(pref + CK.S_DELAY_MESSAGE)); cc.setSessionData(newPref +CK.S_DELAY_MESSAGE, cc.getSessionData(pref + CK.S_DELAY_MESSAGE));
@ -217,7 +217,7 @@ public class StagesPrompt extends StringPrompt implements ColorUtil{
cc.setSessionData(pref + CK.S_SHEAR_COLORS, null); cc.setSessionData(pref + CK.S_SHEAR_COLORS, null);
cc.setSessionData(pref + CK.S_SHEAR_AMOUNTS, null); cc.setSessionData(pref + CK.S_SHEAR_AMOUNTS, null);
cc.setSessionData(pref + CK.S_EVENT, null); cc.setSessionData(pref + CK.S_FINISH_EVENT, null);
cc.setSessionData(pref + CK.S_DELAY, null); cc.setSessionData(pref + CK.S_DELAY, null);
cc.setSessionData(pref + CK.S_DELAY_MESSAGE, null); cc.setSessionData(pref + CK.S_DELAY_MESSAGE, null);

View File

@ -71,7 +71,13 @@ public class CK {
public static final String S_TAME_AMOUNTS = "tameAmounts"; public static final String S_TAME_AMOUNTS = "tameAmounts";
public static final String S_SHEAR_COLORS = "shearColors"; public static final String S_SHEAR_COLORS = "shearColors";
public static final String S_SHEAR_AMOUNTS = "shearAmounts"; public static final String S_SHEAR_AMOUNTS = "shearAmounts";
public static final String S_EVENT = "event"; public static final String S_START_EVENT = "startEvent";
public static final String S_FINISH_EVENT = "finishEvent";
public static final String S_CHAT_EVENTS = "chatEvents";
public static final String S_CHAT_EVENT_TRIGGERS = "chatEventTriggers";
public static final String S_CHAT_TEMP_EVENT = "chatTempEvent";
public static final String S_DEATH_EVENT = "deathEvent";
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";

View File

@ -116,11 +116,23 @@ public class Lang {
en.put("stageEditorTameMobs", "Tame Mobs"); en.put("stageEditorTameMobs", "Tame Mobs");
en.put("stageEditorShearSheep", "Shear Sheep"); en.put("stageEditorShearSheep", "Shear Sheep");
en.put("stageEditorEvents", "Events"); en.put("stageEditorEvents", "Events");
en.put("stageEditorStageEvents", "Stage Events");
en.put("stageEditorStartEvent", "Start Event");
en.put("stageEditorStartEventCleared", "Start Event cleared.");
en.put("stageEditorFinishEvent", "Finish Event");
en.put("stageEditorFinishEventCleared", "Finish Event cleared.");
en.put("stageEditorChatEvents", "Chat Events");
en.put("stageEditorChatTrigger", "Chat Trigger");
en.put("stageEditorTriggeredBy", "Triggered by");
en.put("stageEditorChatEventsCleared", "Chat Events cleared.");
en.put("stageEditorDeathEvent", "Death Event");
en.put("stageEditorDeathEventCleared", "Death Event cleared.");
en.put("stageEditorDisconnectEvent", "Disconnect Event");
en.put("stageEditorDisconnectEventCleared", "Disconnect Event cleared.");
en.put("stageEditorDelayMessage", "Delay Message"); en.put("stageEditorDelayMessage", "Delay Message");
en.put("stageEditorDenizenScript", "Denizen Script"); en.put("stageEditorDenizenScript", "Denizen Script");
en.put("stageEditorStartMessage", "Start Message"); en.put("stageEditorStartMessage", "Start Message");
en.put("stageEditorCompleteMessage", "Complete Message"); en.put("stageEditorCompleteMessage", "Complete Message");
en.put("stageEditorMiniEventMessage", "Mini-Events");
en.put("stageEditorDelete", "Delete Stage"); en.put("stageEditorDelete", "Delete Stage");
en.put("stageEditorDamageBlocks", "Damage Blocks"); en.put("stageEditorDamageBlocks", "Damage Blocks");
@ -148,7 +160,6 @@ public class Lang {
en.put("stageEditorSetShearColors", "Set sheep colors"); en.put("stageEditorSetShearColors", "Set sheep colors");
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("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.");
@ -177,6 +188,9 @@ public class Lang {
en.put("stageEditorShearColorsPrompt", "Enter sheep colors separating each one by a space, or enter \"cancel\" to return"); en.put("stageEditorShearColorsPrompt", "Enter sheep colors separating each one by a space, or enter \"cancel\" to return");
en.put("stageEditorShearAmountsPrompt", "Enter shear amounts separating each one by a space, or enter \"cancel\" to return"); en.put("stageEditorShearAmountsPrompt", "Enter shear amounts separating each one by a space, or enter \"cancel\" to return");
en.put("stageEditorEventsPrompt", "Enter an event name, or enter \"clear\" to clear the event, or \"cancel\" to return"); en.put("stageEditorEventsPrompt", "Enter an event name, or enter \"clear\" to clear the event, or \"cancel\" to return");
en.put("stageEditorChatEventsPrompt", "Enter an event name to add, or enter \"clear\" to clear all chat events, or \"cancel\" to return");
en.put("stageEditorChatEventsTriggerPromptA", "Enter a chat trigger for");
en.put("stageEditorChatEventsTriggerPromptB", "or enter \"cancel\" to return.");
en.put("stageEditorDelayPrompt", "Enter time (in milliseconds), or enter \"clear\" to clear the delay, or \"cancel\" to return"); en.put("stageEditorDelayPrompt", "Enter time (in milliseconds), or enter \"clear\" to clear the delay, or \"cancel\" to return");
en.put("stageEditorDelayMessagePrompt", "Enter delay message, or enter \"clear\" to clear the message, or \"cancel\" to return"); en.put("stageEditorDelayMessagePrompt", "Enter delay message, or enter \"clear\" to clear the message, or \"cancel\" to return");
en.put("stageEditorScriptPrompt", "Enter script name, or enter \"clear\" to clear the script, or \"cancel\" to return"); en.put("stageEditorScriptPrompt", "Enter script name, or enter \"clear\" to clear the script, or \"cancel\" to return");
@ -198,6 +212,7 @@ public class Lang {
en.put("stageEditorInvalidNumber", "is not a number!"); en.put("stageEditorInvalidNumber", "is not a number!");
en.put("stageEditorInvalidDye", "is not a valid dye color!"); en.put("stageEditorInvalidDye", "is not a valid dye color!");
en.put("stageEditorInvalidEvent", "is not a valid event name!"); en.put("stageEditorInvalidEvent", "is not a valid event name!");
en.put("stageEditorDuplicateEvent", "Event is already in the list!");
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:");
@ -454,6 +469,7 @@ public class Lang {
en.put("exit", "Exit"); en.put("exit", "Exit");
en.put("exited", "Exited"); en.put("exited", "Exited");
en.put("cancel", "Cancel"); en.put("cancel", "Cancel");
en.put("back", "Back");
en.put("yes", "Yes"); en.put("yes", "Yes");
en.put("no", "No"); en.put("no", "No");
en.put("clear", "Clear"); en.put("clear", "Clear");

View File

@ -3,9 +3,9 @@ package me.blackvein.quests.util;
import me.blackvein.quests.Quests; import me.blackvein.quests.Quests;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -92,7 +92,7 @@ public class QuestMob {
public void spawn() { public void spawn() {
System.out.println("Spawned!");
World world = spawnLocation.getWorld(); World world = spawnLocation.getWorld();
for (int i = 0; i < spawnAmounts; i++) { for (int i = 0; i < spawnAmounts; i++) {
@ -211,7 +211,6 @@ public class QuestMob {
return false; return false;
} }
System.out.println("1");
QuestMob other = (QuestMob) o; QuestMob other = (QuestMob) o;
if (name.equalsIgnoreCase(other.name) == false) if (name.equalsIgnoreCase(other.name) == false)
@ -220,13 +219,9 @@ public class QuestMob {
if (entityType != other.entityType) if (entityType != other.entityType)
return false; return false;
System.out.println("2");
if (dropChances != other.dropChances) if (dropChances != other.dropChances)
return false; return false;
System.out.println("3");
if (inventory.length == other.inventory.length) { if (inventory.length == other.inventory.length) {
for (int i = 0; i < inventory.length; i++) { for (int i = 0; i < inventory.length; i++) {
if (ItemUtil.compareItems(inventory[i], other.inventory[i], false) != 0) if (ItemUtil.compareItems(inventory[i], other.inventory[i], false) != 0)
@ -236,8 +231,6 @@ public class QuestMob {
return false; return false;
} }
System.out.println("4");
if (spawnAmounts != other.spawnAmounts) if (spawnAmounts != other.spawnAmounts)
return false; return false;

View File

@ -1,6 +1,6 @@
name: Quests name: Quests
main: me.blackvein.quests.Quests main: me.blackvein.quests.Quests
version: 1.6.7 version: 1.6.8
description: Player questing system description: Player questing system
website: http://dev.bukkit.org/server-mods/quests/ website: http://dev.bukkit.org/server-mods/quests/
dev-url: https://github.com/Blackvein/Quests/ dev-url: https://github.com/Blackvein/Quests/