mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-23 01:27:35 +01:00
Extended Event System
Also updated libraries
This commit is contained in:
parent
2bc36ba2cc
commit
8cb9ea0963
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/denizen-0.9.2-SNAPSHOT.jar
Normal file
BIN
lib/denizen-0.9.2-SNAPSHOT.jar
Normal file
Binary file not shown.
4
pom.xml
4
pom.xml
@ -3,7 +3,7 @@
|
||||
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests</artifactId>
|
||||
<version>1.6.7-SNAPSHOT</version>
|
||||
<version>1.6.8-SNAPSHOT</version>
|
||||
<name>quests</name>
|
||||
<url>http://dev.bukkit.org/server-mods/quests/</url>
|
||||
<packaging>jar</packaging>
|
||||
@ -47,7 +47,7 @@
|
||||
<dependency>
|
||||
<groupId>net.aufdemrand</groupId>
|
||||
<artifactId>denizen</artifactId>
|
||||
<version>0.9.1-SNAPSHOT</version>
|
||||
<version>0.9.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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<Integer> shearAmounts;
|
||||
|
||||
String script;
|
||||
String event;
|
||||
String startEvent;
|
||||
String finishEvent;
|
||||
String deathEvent;
|
||||
String disconnectEvent;
|
||||
LinkedList<String> chatEvents;
|
||||
LinkedList<String> 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<Integer>) 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<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) {
|
||||
@ -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<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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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<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
|
||||
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<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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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";
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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/
|
||||
|
Loading…
Reference in New Issue
Block a user