diff --git a/lib/citizensapi-2.0.9-SNAPSHOT.jar b/lib/citizensapi-2.0.9-SNAPSHOT.jar index 46de3f4ad..11952b7bc 100644 Binary files a/lib/citizensapi-2.0.9-SNAPSHOT.jar and b/lib/citizensapi-2.0.9-SNAPSHOT.jar differ diff --git a/lib/craftbukkit-1.6.2-R0.1.jar b/lib/craftbukkit-1.6.4-R0.1.jar similarity index 79% rename from lib/craftbukkit-1.6.2-R0.1.jar rename to lib/craftbukkit-1.6.4-R0.1.jar index dcc2c79d6..6a28f9cae 100644 Binary files a/lib/craftbukkit-1.6.2-R0.1.jar and b/lib/craftbukkit-1.6.4-R0.1.jar differ diff --git a/lib/denizen-0.9.1-SNAPSHOT.jar b/lib/denizen-0.9.1-SNAPSHOT.jar deleted file mode 100644 index 241ab4d76..000000000 Binary files a/lib/denizen-0.9.1-SNAPSHOT.jar and /dev/null differ diff --git a/lib/denizen-0.9.2-SNAPSHOT.jar b/lib/denizen-0.9.2-SNAPSHOT.jar new file mode 100644 index 000000000..bdb18ae23 Binary files /dev/null and b/lib/denizen-0.9.2-SNAPSHOT.jar differ diff --git a/pom.xml b/pom.xml index e6df0de3e..1cdbba4fc 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ me.blackvein.quests quests - 1.6.7-SNAPSHOT + 1.6.8-SNAPSHOT quests http://dev.bukkit.org/server-mods/quests/ jar @@ -47,7 +47,7 @@ net.aufdemrand denizen - 0.9.1-SNAPSHOT + 0.9.2-SNAPSHOT net.milkbowl.vault diff --git a/src/main/java/me/blackvein/quests/PacketUtils.java b/src/main/java/me/blackvein/quests/PacketUtils.java index 94235526a..a6123d2ef 100644 --- a/src/main/java/me/blackvein/quests/PacketUtils.java +++ b/src/main/java/me/blackvein/quests/PacketUtils.java @@ -1,7 +1,7 @@ package me.blackvein.quests; -import net.minecraft.server.v1_6_R2.Packet; -import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import net.minecraft.server.v1_6_R3.Packet; +import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; import org.bukkit.entity.Player; public class PacketUtils { diff --git a/src/main/java/me/blackvein/quests/ParticleEffect.java b/src/main/java/me/blackvein/quests/ParticleEffect.java index 92cee922e..6d3c2c06e 100644 --- a/src/main/java/me/blackvein/quests/ParticleEffect.java +++ b/src/main/java/me/blackvein/quests/ParticleEffect.java @@ -1,10 +1,9 @@ package me.blackvein.quests; 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.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; import org.bukkit.entity.Player; public enum ParticleEffect { diff --git a/src/main/java/me/blackvein/quests/QuestFactory.java b/src/main/java/me/blackvein/quests/QuestFactory.java index ffd5b38c3..ab8751202 100644 --- a/src/main/java/me/blackvein/quests/QuestFactory.java +++ b/src/main/java/me/blackvein/quests/QuestFactory.java @@ -6,7 +6,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; - import me.blackvein.quests.prompts.RequirementsPrompt; import me.blackvein.quests.prompts.RewardsPrompt; 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.Lang; import net.citizensnpcs.api.CitizensAPI; -import net.citizensnpcs.api.npc.NPC; import org.bukkit.ChatColor; import org.bukkit.DyeColor; import org.bukkit.Location; @@ -974,7 +972,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { cs.set("redo-delay", redo); cs.set("ask-message", desc); 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)) { @@ -1059,7 +1057,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { LinkedList shearAmounts; String script; - String event; + String startEvent; + String finishEvent; + String deathEvent; + String disconnectEvent; + LinkedList chatEvents; + LinkedList chatEventTriggers; Long delay; String delayMessage; String startMessage; @@ -1121,7 +1124,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { shearAmounts = null; script = null; - event = null; + startEvent = null; + finishEvent = null; + deathEvent = null; + disconnectEvent = null; + chatEvents = null; + chatEventTriggers = null; delay = null; delayMessage = null; startMessage = null; @@ -1212,8 +1220,25 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { shearAmounts = (LinkedList) cc.getSessionData(pref + CK.S_SHEAR_AMOUNTS); } - if (cc.getSessionData(pref + CK.S_EVENT) != null) { - event = (String) cc.getSessionData(pref + CK.S_EVENT); + if (cc.getSessionData(pref + CK.S_START_EVENT) != null) { + 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) cc.getSessionData(pref + CK.S_CHAT_EVENTS); + chatEventTriggers = (LinkedList) cc.getSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS); } 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-amounts", shearAmounts); 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-message", delayMessage); 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) { - 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 chatEvents = new LinkedList(); + LinkedList chatEventTriggers = new LinkedList(); + + 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); + } diff --git a/src/main/java/me/blackvein/quests/Quester.java b/src/main/java/me/blackvein/quests/Quester.java index b47c84ed4..3ef479341 100644 --- a/src/main/java/me/blackvein/quests/Quester.java +++ b/src/main/java/me/blackvein/quests/Quester.java @@ -5,7 +5,6 @@ import java.util.*; import java.util.Map.Entry; import java.util.logging.Level; import me.blackvein.quests.util.ItemUtil; -import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.npc.NPC; import org.bukkit.ChatColor; import org.bukkit.DyeColor; @@ -1208,9 +1207,6 @@ public class Quester { public void addEmpties() { - System.out.println("Adding empties."); - System.out.println("Citizens to kill: " + currentStage.citizensToKill.size()); - if (currentStage.blocksToDamage.isEmpty() == false) { for (Material m : currentStage.blocksToDamage.keySet()) { @@ -1298,7 +1294,6 @@ public class Quester { if (currentStage.citizensToKill.isEmpty() == false) { for (Integer n : currentStage.citizensToKill) { - System.out.println("Adding.."); citizensKilled.add(n); citizenNumKilled.add(0); diff --git a/src/main/java/me/blackvein/quests/StageTimer.java b/src/main/java/me/blackvein/quests/StageTimer.java index 46b42a87d..f9849da7e 100644 --- a/src/main/java/me/blackvein/quests/StageTimer.java +++ b/src/main/java/me/blackvein/quests/StageTimer.java @@ -42,7 +42,6 @@ public class StageTimer implements Runnable{ quester.currentStage.finishEvent.fire(quester); quester.currentStage = quester.currentQuest.stages.get(quester.currentStageIndex + 1); quester.currentStageIndex++; - System.out.println("Adding empties from stage timer"); quester.addEmpties(); quester.delayStartTime = 0; quester.delayTimeLeft = -1; diff --git a/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java b/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java index 11187fd93..16e4ebc70 100644 --- a/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java @@ -3,7 +3,6 @@ package me.blackvein.quests.prompts; import java.util.Arrays; import java.util.LinkedList; import java.util.List; - import me.ThaH3lper.com.LoadBosses.LoadBoss; import me.blackvein.quests.ColorUtil; import me.blackvein.quests.Event; @@ -15,7 +14,6 @@ import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.Lang; import net.aufdemrand.denizen.scripts.ScriptRegistry; import net.citizensnpcs.api.CitizensPlugin; - import org.bukkit.Location; import org.bukkit.Material; 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") + 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"; - } + text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- " + Lang.get("stageEditorEvents") + "\n"; if (context.getSessionData(pref + CK.S_DELAY) == null) { 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")) { return new ShearListPrompt(); } else if (input.equalsIgnoreCase("17")) { - return new EventsPrompt(); + return new EventListPrompt(); } else if (input.equalsIgnoreCase("18")) { return new DelayPrompt(); } 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 public String getPromptText(ConversationContext context) { - String text = DARKGREEN + "- " + Lang.get("stageEditorEvents") + " -\n"; - if (questFactory.quests.events.isEmpty()) { - text += RED + "- None"; - } else { - for (Event e : questFactory.quests.events) { - text += GREEN + "- " + e.getName() + "\n"; - } + String text = GREEN + "- " + Lang.get("stageEditorStageEvents") + " -\n"; + + if(context.getSessionData(pref + CK.S_START_EVENT) == null) + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorStartEvent") + " (" + Lang.get("noneSet") + ")\n"; + else + 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 chatEvents = (LinkedList) context.getSessionData(pref + CK.S_CHAT_EVENTS); + LinkedList chatEventTriggers = (LinkedList) 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 - public Prompt acceptValidatedInput(ConversationContext context, String input) { + protected Prompt acceptValidatedInput(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 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."); + if(input.equalsIgnoreCase("1")) + return new StartEventPrompt(); + else if(input.equalsIgnoreCase("2")) + return new FinishEventPrompt(); + else if(input.equalsIgnoreCase("3")) + return new DeathEventPrompt(); + else if(input.equalsIgnoreCase("4")) + return new DisconnectEventPrompt(); + else if(input.equalsIgnoreCase("5")) + return new ChatEventPrompt(); + else if(input.equalsIgnoreCase("6")) return new CreateStagePrompt(stageNum, questFactory, citizens); - } else { - return new CreateStagePrompt(stageNum, questFactory, citizens); - } + else + return new EventListPrompt(); } + } - private class EventPrompt extends StringPrompt { + private class StartEventPrompt extends StringPrompt { @Override public String getPromptText(ConversationContext context) { - String text = DARKGREEN + "- " + Lang.get("stageEditorEvents") + " -\n"; + String text = DARKGREEN + "- " + Lang.get("stageEditorStartEvent") + " -\n"; if (questFactory.quests.events.isEmpty()) { text += RED + "- None"; } else { @@ -3466,18 +3481,308 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (found == null) { player.sendMessage(RED + input + YELLOW + " " + Lang.get("stageEditorInvalidEvent")); - return new EventPrompt(); + return new StartEventPrompt(); } else { - context.setSessionData(pref + CK.S_EVENT, found.getName()); - return new CreateStagePrompt(stageNum, questFactory, citizens); + context.setSessionData(pref + CK.S_START_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_EVENT, null); - player.sendMessage(YELLOW + "Event cleared."); - return new CreateStagePrompt(stageNum, questFactory, citizens); + context.setSessionData(pref + CK.S_START_EVENT, null); + player.sendMessage(YELLOW + Lang.get("stageEditorStartEventCleared")); + return new EventListPrompt(); } 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 chatEvents = new LinkedList(); + LinkedList chatEventTriggers = new LinkedList(); + + 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 chatEvents = (LinkedList) context.getSessionData(pref + CK.S_CHAT_EVENTS); + LinkedList chatEventTriggers = (LinkedList) 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(); } } diff --git a/src/main/java/me/blackvein/quests/prompts/StagesPrompt.java b/src/main/java/me/blackvein/quests/prompts/StagesPrompt.java index 03634fff6..2cb59a60d 100644 --- a/src/main/java/me/blackvein/quests/prompts/StagesPrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/StagesPrompt.java @@ -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_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_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_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_MESSAGE, null); diff --git a/src/main/java/me/blackvein/quests/util/CK.java b/src/main/java/me/blackvein/quests/util/CK.java index a25ab08f5..567a96d4a 100644 --- a/src/main/java/me/blackvein/quests/util/CK.java +++ b/src/main/java/me/blackvein/quests/util/CK.java @@ -71,7 +71,13 @@ public class CK { public static final String S_TAME_AMOUNTS = "tameAmounts"; public static final String S_SHEAR_COLORS = "shearColors"; 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_MESSAGE = "delayMessage"; public static final String S_DENIZEN = "denizen"; diff --git a/src/main/java/me/blackvein/quests/util/Lang.java b/src/main/java/me/blackvein/quests/util/Lang.java index f813c0efa..47958b999 100644 --- a/src/main/java/me/blackvein/quests/util/Lang.java +++ b/src/main/java/me/blackvein/quests/util/Lang.java @@ -116,11 +116,23 @@ public class Lang { en.put("stageEditorTameMobs", "Tame Mobs"); en.put("stageEditorShearSheep", "Shear Sheep"); 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("stageEditorDenizenScript", "Denizen Script"); en.put("stageEditorStartMessage", "Start Message"); en.put("stageEditorCompleteMessage", "Complete Message"); - en.put("stageEditorMiniEventMessage", "Mini-Events"); en.put("stageEditorDelete", "Delete Stage"); en.put("stageEditorDamageBlocks", "Damage Blocks"); @@ -148,7 +160,6 @@ public class Lang { en.put("stageEditorSetShearColors", "Set sheep colors"); en.put("stageEditorSetShearAmounts", "Set shear amounts"); 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("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("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("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("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"); @@ -198,6 +212,7 @@ public class Lang { en.put("stageEditorInvalidNumber", "is not a number!"); en.put("stageEditorInvalidDye", "is not a valid dye color!"); 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("stageEditorInvalidScript", "Denizen script not found!"); en.put("stageEditorInvalidBoss", "Could not find Boss with the name:"); @@ -454,6 +469,7 @@ public class Lang { en.put("exit", "Exit"); en.put("exited", "Exited"); en.put("cancel", "Cancel"); + en.put("back", "Back"); en.put("yes", "Yes"); en.put("no", "No"); en.put("clear", "Clear"); diff --git a/src/main/java/me/blackvein/quests/util/QuestMob.java b/src/main/java/me/blackvein/quests/util/QuestMob.java index 1e1bbea1e..a9ed19e00 100644 --- a/src/main/java/me/blackvein/quests/util/QuestMob.java +++ b/src/main/java/me/blackvein/quests/util/QuestMob.java @@ -3,9 +3,9 @@ package me.blackvein.quests.util; import me.blackvein.quests.Quests; import org.bukkit.Location; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; -import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -92,7 +92,7 @@ public class QuestMob { public void spawn() { - System.out.println("Spawned!"); + World world = spawnLocation.getWorld(); for (int i = 0; i < spawnAmounts; i++) { @@ -211,7 +211,6 @@ public class QuestMob { return false; } - System.out.println("1"); QuestMob other = (QuestMob) o; if (name.equalsIgnoreCase(other.name) == false) @@ -220,13 +219,9 @@ public class QuestMob { if (entityType != other.entityType) return false; - System.out.println("2"); - if (dropChances != other.dropChances) return false; - System.out.println("3"); - if (inventory.length == other.inventory.length) { for (int i = 0; i < inventory.length; i++) { if (ItemUtil.compareItems(inventory[i], other.inventory[i], false) != 0) @@ -236,8 +231,6 @@ public class QuestMob { return false; } - System.out.println("4"); - if (spawnAmounts != other.spawnAmounts) return false; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 710b9933c..2567bfebf 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: Quests main: me.blackvein.quests.Quests -version: 1.6.7 +version: 1.6.8 description: Player questing system website: http://dev.bukkit.org/server-mods/quests/ dev-url: https://github.com/Blackvein/Quests/