mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-25 20:25:45 +01:00
NEW date/time Planner section, part 1, #93. Bump version number
This commit is contained in:
parent
b91e7b9218
commit
b7bde5575e
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests</artifactId>
|
||||
<version>3.2.7</version>
|
||||
<version>3.2.8</version>
|
||||
<name>quests</name>
|
||||
<url>https://github.com/FlyingPikachu/Quests/</url>
|
||||
<packaging>jar</packaging>
|
||||
|
@ -110,11 +110,11 @@ public class NpcListener implements Listener {
|
||||
if (quester.currentQuests.containsKey(q))
|
||||
continue;
|
||||
if (q.npcStart != null && q.npcStart.getId() == evt.getNPC().getId()) {
|
||||
if (plugin.ignoreLockedQuests && (quester.completedQuests.contains(q.name) == false || q.redoDelay > -1)) {
|
||||
if (plugin.ignoreLockedQuests && (quester.completedQuests.contains(q.name) == false || q.cooldownPlanner > -1)) {
|
||||
if (q.testRequirements(quester)) {
|
||||
npcQuests.add(q);
|
||||
}
|
||||
} else if (quester.completedQuests.contains(q.name) == false || q.redoDelay > -1) {
|
||||
} else if (quester.completedQuests.contains(q.name) == false || q.cooldownPlanner > -1) {
|
||||
npcQuests.add(q);
|
||||
}
|
||||
}
|
||||
@ -149,7 +149,7 @@ public class NpcListener implements Listener {
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + early);
|
||||
} else if (q.redoDelay < 0) {
|
||||
} else if (q.cooldownPlanner < 0) {
|
||||
String completed = Lang.get(player, "questAlreadyCompleted");
|
||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + completed);
|
||||
|
@ -112,7 +112,7 @@ public class PlayerListener implements Listener {
|
||||
String msg = Lang.get(player, "questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
} else if (quester.completedQuests.contains(quest.name) && quest.redoDelay < 0) {
|
||||
} else if (quester.completedQuests.contains(quest.name) && quest.cooldownPlanner < 0) {
|
||||
String completed = Lang.get(player, "questAlreadyCompleted");
|
||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + completed);
|
||||
@ -250,13 +250,13 @@ public class PlayerListener implements Listener {
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
} else {
|
||||
if (quester.completedQuests.contains(q.name)) {
|
||||
if (q.redoDelay > -1 && (quester.getDifference(q)) > 0) {
|
||||
if (q.cooldownPlanner > -1 && (quester.getDifference(q)) > 0) {
|
||||
String early = Lang.get(player, "questTooEarly");
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + early);
|
||||
return;
|
||||
} else if (quester.completedQuests.contains(q.name) && q.redoDelay < 0) {
|
||||
} else if (quester.completedQuests.contains(q.name) && q.cooldownPlanner < 0) {
|
||||
String completed = Lang.get(player, "questAlreadyCompleted");
|
||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + completed);
|
||||
@ -655,7 +655,7 @@ public class PlayerListener implements Listener {
|
||||
for (String s : quester.completedQuests) {
|
||||
Quest q = plugin.getQuest(s);
|
||||
if (q != null) {
|
||||
if (quester.completedTimes.containsKey(q.name) == false && q.redoDelay > -1) {
|
||||
if (quester.completedTimes.containsKey(q.name) == false && q.cooldownPlanner > -1) {
|
||||
quester.completedTimes.put(q.name, System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ public class Quest {
|
||||
public String name;
|
||||
public String description;
|
||||
public String finished;
|
||||
public long redoDelay = -1;
|
||||
public String region = null;
|
||||
public ItemStack guiDisplay = null;
|
||||
public int parties = 0;
|
||||
@ -70,7 +69,6 @@ public class Quest {
|
||||
Map<String, Map<String, Object>> customRequirements = new HashMap<String, Map<String, Object>>();
|
||||
Map<String, Map<String, Object>> customRewards = new HashMap<String, Map<String, Object>>();
|
||||
public String failRequirements = null;
|
||||
//
|
||||
// Rewards
|
||||
int moneyReward = 0;
|
||||
int questPoints = 0;
|
||||
@ -83,7 +81,11 @@ public class Quest {
|
||||
List<String> heroesClasses = new LinkedList<String>();
|
||||
List<Double> heroesAmounts = new LinkedList<Double>();
|
||||
List<String> phatLootRewards = new LinkedList<String>();
|
||||
//
|
||||
//Planner
|
||||
public long startPlanner = -1;
|
||||
public long endPlanner = -1;
|
||||
public long repeatPlanner = -1;
|
||||
public long cooldownPlanner = -1;
|
||||
|
||||
public Stage getStage(int index) {
|
||||
try {
|
||||
@ -299,7 +301,7 @@ public class Quest {
|
||||
Quests.economy.depositPlayer(q.getOfflinePlayer(), moneyReward);
|
||||
none = null;
|
||||
}
|
||||
if (redoDelay > -1) {
|
||||
if (cooldownPlanner > -1) {
|
||||
q.completedTimes.put(this.name, System.currentTimeMillis());
|
||||
if (q.amountsCompleted.containsKey(this.name)) {
|
||||
q.amountsCompleted.put(this.name, q.amountsCompleted.get(this.name) + 1);
|
||||
@ -649,10 +651,19 @@ public class Quest {
|
||||
if (other.questPointsReq != questPointsReq) {
|
||||
return false;
|
||||
}
|
||||
if (other.redoDelay != redoDelay) {
|
||||
if (other.orderedStages.equals(orderedStages) == false) {
|
||||
return false;
|
||||
}
|
||||
if (other.orderedStages.equals(orderedStages) == false) {
|
||||
if (other.startPlanner != startPlanner) {
|
||||
return false;
|
||||
}
|
||||
if (other.endPlanner != endPlanner) {
|
||||
return false;
|
||||
}
|
||||
if (other.repeatPlanner != repeatPlanner) {
|
||||
return false;
|
||||
}
|
||||
if (other.cooldownPlanner != cooldownPlanner) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@ -667,7 +678,10 @@ public class Quest {
|
||||
hash = 53 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 53 * hash + (this.description != null ? this.description.hashCode() : 0);
|
||||
hash = 53 * hash + (this.finished != null ? this.finished.hashCode() : 0);
|
||||
hash = 53 * hash + (int) (this.redoDelay ^ (this.redoDelay >>> 32));
|
||||
hash = 53 * hash + (int) (this.startPlanner ^ (this.startPlanner >>> 32));
|
||||
hash = 53 * hash + (int) (this.endPlanner ^ (this.endPlanner >>> 32));
|
||||
hash = 53 * hash + (int) (this.repeatPlanner ^ (this.repeatPlanner >>> 32));
|
||||
hash = 53 * hash + (int) (this.cooldownPlanner ^ (this.cooldownPlanner >>> 32));
|
||||
hash = 53 * hash + (this.region != null ? this.region.hashCode() : 0);
|
||||
hash = 53 * hash + (this.guiDisplay != null ? this.guiDisplay.hashCode() : 0);
|
||||
hash = 53 * hash + (this.orderedStages != null ? this.orderedStages.hashCode() : 0);
|
||||
|
@ -50,6 +50,7 @@ import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import me.blackvein.quests.prompts.ItemStackPrompt;
|
||||
import me.blackvein.quests.prompts.RequirementsPrompt;
|
||||
import me.blackvein.quests.prompts.RewardsPrompt;
|
||||
import me.blackvein.quests.prompts.PlannerPrompt;
|
||||
import me.blackvein.quests.prompts.StagesPrompt;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
@ -154,104 +155,49 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorFinishMessage") + " (\"" + context.getSessionData(CK.Q_FINISH_MESSAGE) + "\")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.Q_REDO_DELAY) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorRedoDelay") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorRedoDelay") + " (" + Quests.getTime((Long) context.getSessionData(CK.Q_REDO_DELAY)) + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.Q_START_NPC) == null && Quests.citizens != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else if (Quests.citizens != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + CitizensAPI.getNPCRegistry().getById((Integer) context.getSessionData(CK.Q_START_NPC)).getName() + ")\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + CitizensAPI.getNPCRegistry().getById((Integer) context.getSessionData(CK.Q_START_NPC)).getName() + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + Lang.get("questCitNotInstalled") + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.Q_START_BLOCK) == null) {
|
||||
if (Quests.citizens != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + Lang.get("noneSet") + ")\n";
|
||||
}
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
if (Quests.citizens != null) {
|
||||
Location l = (Location) context.getSessionData(CK.Q_START_BLOCK);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")\n";
|
||||
} else {
|
||||
Location l = (Location) context.getSessionData(CK.Q_START_BLOCK);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")\n";
|
||||
}
|
||||
Location l = (Location) context.getSessionData(CK.Q_START_BLOCK);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")\n";
|
||||
}
|
||||
if (Quests.worldGuard != null) {
|
||||
if (context.getSessionData(CK.Q_REGION) == null) {
|
||||
if (Quests.citizens != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + Lang.get("noneSet") + ")\n";
|
||||
}
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
if (Quests.citizens != null) {
|
||||
String s = (String) context.getSessionData(CK.Q_REGION);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + ChatColor.GREEN + s + ChatColor.YELLOW + ")\n";
|
||||
} else {
|
||||
String s = (String) context.getSessionData(CK.Q_REGION);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + ChatColor.GREEN + s + ChatColor.YELLOW + ")\n";
|
||||
}
|
||||
String s = (String) context.getSessionData(CK.Q_REGION);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + ChatColor.GREEN + s + ChatColor.YELLOW + ")\n";
|
||||
}
|
||||
} else {
|
||||
if (Quests.citizens != null) {
|
||||
text += ChatColor.GRAY + "7 - " + Lang.get("questWGSetRegion") + " (" + Lang.get("questWGNotInstalled") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.GRAY + "6 - " + Lang.get("questWGSetRegion") + " (" + Lang.get("questWGNotInstalled") + ")\n";
|
||||
}
|
||||
text += ChatColor.GRAY + "6 - " + Lang.get("questWGSetRegion") + " (" + Lang.get("questWGNotInstalled") + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.Q_INITIAL_EVENT) == null) {
|
||||
if (Quests.citizens != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + Lang.get("noneSet") + ")\n";
|
||||
}
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
if (Quests.citizens != null) {
|
||||
String s = (String) context.getSessionData(CK.Q_INITIAL_EVENT);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + s + ")\n";
|
||||
} else {
|
||||
String s = (String) context.getSessionData(CK.Q_INITIAL_EVENT);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + s + ")\n";
|
||||
}
|
||||
String s = (String) context.getSessionData(CK.Q_INITIAL_EVENT);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + s + ")\n";
|
||||
}
|
||||
if (Quests.citizens != null) {
|
||||
if (context.getSessionData(CK.Q_GUIDISPLAY) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
ItemStack stack = (ItemStack) context.getSessionData(CK.Q_GUIDISPLAY);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorSetGUI") + " (" + ItemUtil.getDisplayString(stack) + ChatColor.RESET + ChatColor.YELLOW + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.Q_GUIDISPLAY) == null && Quests.citizens != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else if (Quests.citizens != null ){
|
||||
ItemStack stack = (ItemStack) context.getSessionData(CK.Q_GUIDISPLAY);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorSetGUI") + " (" + ItemUtil.getDisplayString(stack) + ChatColor.RESET + ChatColor.YELLOW + ")\n";
|
||||
} else {
|
||||
text += ChatColor.GRAY + "8 - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("questCitNotInstalled") + ")\n";
|
||||
}
|
||||
if (Quests.citizens != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.DARK_AQUA + " - " + Lang.get("questEditorReqs") + "\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.DARK_AQUA + " - " + Lang.get("questEditorReqs") + "\n";
|
||||
}
|
||||
if (Quests.citizens != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.LIGHT_PURPLE + " - " + Lang.get("questEditorStages") + "\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.LIGHT_PURPLE + " - " + Lang.get("questEditorStages") + "\n";
|
||||
}
|
||||
if (Quests.citizens != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("questEditorRews") + "\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("questEditorRews") + "\n";
|
||||
}
|
||||
if (Quests.citizens != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("save") + "\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("save") + "\n";
|
||||
}
|
||||
if (Quests.citizens != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "14" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("exit") + "\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("exit") + "\n";
|
||||
}
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.DARK_AQUA + " - " + Lang.get("questEditorReqs") + "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.DARK_PURPLE + " - " + Lang.get("questEditorPlned") + " **WIP**" + "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.LIGHT_PURPLE + " - " + Lang.get("questEditorStages") + "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("questEditorRews") + "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("save") + "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "14" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("exit") + "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
@ -264,73 +210,40 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new FinishMessagePrompt();
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
return new RedoDelayPrompt();
|
||||
} else if (input.equalsIgnoreCase("5")) {
|
||||
if (Quests.citizens != null) {
|
||||
return new SetNpcStartPrompt();
|
||||
} else {
|
||||
selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
return new BlockStartPrompt();
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("5")) {
|
||||
selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
return new BlockStartPrompt();
|
||||
} else if (input.equalsIgnoreCase("6")) {
|
||||
if (Quests.citizens != null) {
|
||||
selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
return new BlockStartPrompt();
|
||||
} else if (Quests.worldGuard != null) {
|
||||
if (Quests.worldGuard != null) {
|
||||
return new RegionPrompt();
|
||||
} else {
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("7")) {
|
||||
if (Quests.citizens != null && Quests.worldGuard != null) {
|
||||
return new RegionPrompt();
|
||||
} else if (Quests.citizens != null) {
|
||||
return new CreateMenuPrompt();
|
||||
} else {
|
||||
return new InitialEventPrompt();
|
||||
}
|
||||
return new InitialEventPrompt();
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
if (Quests.citizens != null) {
|
||||
return new InitialEventPrompt();
|
||||
} else {
|
||||
return new GUIDisplayPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("9")) {
|
||||
if (Quests.citizens != null) {
|
||||
return new GUIDisplayPrompt();
|
||||
} else {
|
||||
return new RequirementsPrompt(plugin, QuestFactory.this);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("10")) {
|
||||
if (Quests.citizens != null) {
|
||||
return new RequirementsPrompt(plugin, QuestFactory.this);
|
||||
} else {
|
||||
return new StagesPrompt(QuestFactory.this);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("11")) {
|
||||
if (Quests.citizens != null) {
|
||||
return new StagesPrompt(QuestFactory.this);
|
||||
} else {
|
||||
return new RewardsPrompt(plugin, QuestFactory.this);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("12")) {
|
||||
if (Quests.citizens != null) {
|
||||
return new RewardsPrompt(plugin, QuestFactory.this);
|
||||
} else {
|
||||
return new SavePrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("13")) {
|
||||
if (Quests.citizens != null) {
|
||||
return new SavePrompt();
|
||||
} else {
|
||||
return new ExitPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("14")) {
|
||||
if (Quests.citizens != null) {
|
||||
return new ExitPrompt();
|
||||
} else {
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
return new RequirementsPrompt(plugin, QuestFactory.this);
|
||||
} else if (input.equalsIgnoreCase("10")) {
|
||||
return new PlannerPrompt(plugin, QuestFactory.this);
|
||||
} else if (input.equalsIgnoreCase("11")) {
|
||||
return new StagesPrompt(QuestFactory.this);
|
||||
} else if (input.equalsIgnoreCase("12")) {
|
||||
return new RewardsPrompt(plugin, QuestFactory.this);
|
||||
} else if (input.equalsIgnoreCase("13")) {
|
||||
return new SavePrompt();
|
||||
} else if (input.equalsIgnoreCase("14")) {
|
||||
return new ExitPrompt();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -716,40 +629,6 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
}
|
||||
|
||||
private class RedoDelayPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("questEditorEnterRedoDelay");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.Q_REDO_DELAY, null);
|
||||
}
|
||||
long delay;
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
delay = i * 1000;
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " " + Lang.get("stageEditorInvalidNumber"));
|
||||
return new RedoDelayPrompt();
|
||||
}
|
||||
if (delay < -1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
|
||||
} else if (delay == 0) {
|
||||
context.setSessionData(CK.Q_REDO_DELAY, null);
|
||||
} else if (delay != -1) {
|
||||
context.setSessionData(CK.Q_REDO_DELAY, delay);
|
||||
}
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
}
|
||||
|
||||
private class SavePrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
@ -851,7 +730,6 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
String name = (String) cc.getSessionData(CK.Q_NAME);
|
||||
String desc = (String) cc.getSessionData(CK.Q_ASK_MESSAGE);
|
||||
String finish = (String) cc.getSessionData(CK.Q_FINISH_MESSAGE);
|
||||
Long redo = null;
|
||||
Integer npcStart = null;
|
||||
String blockStart = null;
|
||||
String initialEvent = null;
|
||||
@ -886,9 +764,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
LinkedList<String> phatLootRews = null;
|
||||
LinkedList<String> customRews = null;
|
||||
LinkedList<Map<String, Object>> customRewsData = null;
|
||||
if (cc.getSessionData(CK.Q_REDO_DELAY) != null) {
|
||||
redo = (Long) cc.getSessionData(CK.Q_REDO_DELAY);
|
||||
}
|
||||
Long startDatePln = null;
|
||||
Long endDatePln = null;
|
||||
Long repeatCyclePln = null;
|
||||
Long cooldownPln = null;
|
||||
if (cc.getSessionData(CK.Q_START_NPC) != null) {
|
||||
npcStart = (Integer) cc.getSessionData(CK.Q_START_NPC);
|
||||
}
|
||||
@ -977,12 +856,21 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
customRews = (LinkedList<String>) cc.getSessionData(CK.REW_CUSTOM);
|
||||
customRewsData = (LinkedList<Map<String, Object>>) cc.getSessionData(CK.REW_CUSTOM_DATA);
|
||||
}
|
||||
if (cc.getSessionData(CK.PLN_START_DATE) != null) {
|
||||
startDatePln = (Long) cc.getSessionData(CK.PLN_START_DATE);
|
||||
}
|
||||
if (cc.getSessionData(CK.PLN_END_DATE) != null) {
|
||||
endDatePln = (Long) cc.getSessionData(CK.PLN_END_DATE);
|
||||
}
|
||||
if (cc.getSessionData(CK.PLN_REPEAT_CYCLE) != null) {
|
||||
repeatCyclePln = (Long) cc.getSessionData(CK.PLN_REPEAT_CYCLE);
|
||||
}
|
||||
if (cc.getSessionData(CK.PLN_COOLDOWN) != null) {
|
||||
cooldownPln = (Long) cc.getSessionData(CK.PLN_COOLDOWN);
|
||||
}
|
||||
cs.set("name", name);
|
||||
cs.set("npc-giver-id", npcStart);
|
||||
cs.set("block-start", blockStart);
|
||||
if (redo != null) {
|
||||
cs.set("redo-delay", redo.intValue() / 1000);
|
||||
}
|
||||
cs.set("ask-message", desc);
|
||||
cs.set("finish-message", finish);
|
||||
cs.set("event", initialEvent);
|
||||
@ -1384,6 +1272,23 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
} else {
|
||||
cs.set("rewards", null);
|
||||
}
|
||||
if (startDatePln != null || endDatePln != null || repeatCyclePln != null || cooldownPln != null) {
|
||||
ConfigurationSection sch = cs.createSection("planner");
|
||||
if (startDatePln != null) {
|
||||
sch.set("start", startDatePln.intValue() / 1000);
|
||||
}
|
||||
if (endDatePln != null) {
|
||||
sch.set("end", endDatePln.intValue() / 1000);
|
||||
}
|
||||
if (repeatCyclePln != null) {
|
||||
sch.set("repeat", repeatCyclePln.intValue() / 1000);
|
||||
}
|
||||
if (cooldownPln != null) {
|
||||
sch.set("cooldown", cooldownPln.intValue() / 1000);
|
||||
}
|
||||
} else {
|
||||
cs.set("planner", null);
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadQuest(ConversationContext cc, Quest q) {
|
||||
@ -1393,9 +1298,6 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
cc.setSessionData(CK.Q_START_NPC, q.npcStart.getId());
|
||||
}
|
||||
cc.setSessionData(CK.Q_START_BLOCK, q.blockStart);
|
||||
if (q.redoDelay != -1) {
|
||||
cc.setSessionData(CK.Q_REDO_DELAY, q.redoDelay);
|
||||
}
|
||||
cc.setSessionData(CK.Q_ASK_MESSAGE, q.description);
|
||||
cc.setSessionData(CK.Q_FINISH_MESSAGE, q.finished);
|
||||
if (q.initialEvent != null) {
|
||||
@ -1494,6 +1396,20 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
cc.setSessionData(CK.REW_CUSTOM_DATA, new LinkedList<Object>(q.customRewards.values()));
|
||||
}
|
||||
//
|
||||
//Planner
|
||||
if (q.startPlanner != -1) {
|
||||
cc.setSessionData(CK.PLN_START_DATE, q.startPlanner);
|
||||
}
|
||||
if (q.endPlanner != -1) {
|
||||
cc.setSessionData(CK.PLN_END_DATE, q.endPlanner);
|
||||
}
|
||||
if (q.repeatPlanner != -1) {
|
||||
cc.setSessionData(CK.PLN_REPEAT_CYCLE, q.repeatPlanner);
|
||||
}
|
||||
if (q.cooldownPlanner != -1) {
|
||||
cc.setSessionData(CK.PLN_COOLDOWN, q.cooldownPlanner);
|
||||
}
|
||||
//
|
||||
// Stages
|
||||
int index = 1;
|
||||
for (Stage stage : q.orderedStages) {
|
||||
|
@ -1565,7 +1565,7 @@ public class Quester {
|
||||
} else {
|
||||
lastTime = completedTimes.get(q.name);
|
||||
}
|
||||
long comparator = q.redoDelay;
|
||||
long comparator = q.cooldownPlanner;
|
||||
long difference = (comparator - (currentTime - lastTime));
|
||||
return difference;
|
||||
}
|
||||
|
@ -1636,7 +1636,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
} else if (quester.currentQuests.containsKey(q)) {
|
||||
String msg = Lang.get(player, "questAlreadyOn");
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
} else if (quester.completedQuests.contains(q.name) && q.redoDelay < 0) {
|
||||
} else if (quester.completedQuests.contains(q.name) && q.cooldownPlanner < 0) {
|
||||
String msg = Lang.get(player, "questAlreadyCompleted");
|
||||
msg = msg.replaceAll("<quest>", ChatColor.DARK_PURPLE + q.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
@ -1783,7 +1783,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
Quester quester = getQuester(player.getUniqueId());
|
||||
cs.sendMessage(ChatColor.GOLD + "- " + q.name + " -");
|
||||
cs.sendMessage(" ");
|
||||
if (q.redoDelay > -1) {
|
||||
/*if (q.redoDelay > -1) {
|
||||
if (q.redoDelay == 0) {
|
||||
cs.sendMessage(ChatColor.DARK_AQUA + Lang.get("readoable"));
|
||||
} else {
|
||||
@ -1791,7 +1791,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
msg = msg.replaceAll("<time>", ChatColor.AQUA + getTime(q.redoDelay) + ChatColor.DARK_AQUA);
|
||||
cs.sendMessage(ChatColor.DARK_AQUA + msg);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (q.npcStart != null) {
|
||||
String msg = Lang.get("speakTo");
|
||||
msg = msg.replaceAll("<npc>", q.npcStart.getName());
|
||||
@ -2207,8 +2207,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
if (config.contains("quests." + questName + ".redo-delay")) {
|
||||
//Legacy
|
||||
if (config.getInt("quests." + questName + ".redo-delay", -999) != -999) {
|
||||
quest.redoDelay = config.getInt("quests." + questName + ".redo-delay") * 1000;
|
||||
quest.cooldownPlanner = config.getInt("quests." + questName + ".redo-delay") * 1000;
|
||||
} else {
|
||||
skipQuestProcess("redo-delay: for Quest " + quest.name + " is not a number!");
|
||||
}
|
||||
@ -2234,6 +2235,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (config.contains("quests." + questName + ".requirements")) {
|
||||
loadQuestRequirements(config, questsSection);
|
||||
}
|
||||
if (config.contains("quests." + questName + ".planner")) {
|
||||
loadQuestPlanner(config, questsSection);
|
||||
}
|
||||
quest.plugin = this;
|
||||
processStages(quest, config, questName); // needsSaving may be modified as a side-effect
|
||||
loadRewards(config);
|
||||
@ -2563,6 +2567,29 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadQuestPlanner(FileConfiguration config, ConfigurationSection questsSection) throws SkipQuest {
|
||||
if (config.contains("quests." + questName + ".planner.start")) {
|
||||
quest.startPlanner = config.getLong("quests." + questName + ".planner.start");
|
||||
} /*else {
|
||||
skipQuestProcess("Planner for Quest " + quest.name + " is missing start:");
|
||||
}*/
|
||||
if (config.contains("quests." + questName + ".planner.end")) {
|
||||
quest.endPlanner = config.getLong("quests." + questName + ".planner.end");
|
||||
} /*else {
|
||||
skipQuestProcess("Planner for Quest " + quest.name + " is missing end:");
|
||||
}*/
|
||||
if (config.contains("quests." + questName + ".planner.repeat")) {
|
||||
quest.repeatPlanner = config.getLong("quests." + questName + ".planner.repeat");
|
||||
} /*else {
|
||||
skipQuestProcess("Planner for Quest " + quest.name + " is missing repeat:");
|
||||
}*/
|
||||
if (config.contains("quests." + questName + ".planner.cooldown")) {
|
||||
quest.cooldownPlanner = config.getLong("quests." + questName + ".planner.cooldown");
|
||||
} /*else {
|
||||
skipQuestProcess("Planner for Quest " + quest.name + " is missing cooldown:");
|
||||
}*/
|
||||
}
|
||||
|
||||
private void skipQuestProcess(String[] msgs) throws SkipQuest {
|
||||
for (String msg : msgs) {
|
||||
@ -4063,7 +4090,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
|
||||
public boolean hasCompletedRedoableQuest(NPC npc, Quester quester) {
|
||||
for (Quest q : quests) {
|
||||
if (q.npcStart != null && quester.completedQuests.contains(q.name) == true && q.redoDelay > -1) {
|
||||
if (q.npcStart != null && quester.completedQuests.contains(q.name) == true && q.cooldownPlanner > -1) {
|
||||
if (q.npcStart.getId() == npc.getId()) {
|
||||
if (ignoreLockedQuests == false || ignoreLockedQuests == true && q.testRequirements(quester) == true) {
|
||||
return true;
|
||||
|
@ -0,0 +1,50 @@
|
||||
package me.blackvein.quests.prompts;
|
||||
|
||||
import me.blackvein.quests.util.Lang;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.FixedSetPrompt;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
|
||||
public class DateTimePrompt extends FixedSetPrompt {
|
||||
|
||||
final Prompt oldPrompt;
|
||||
|
||||
public DateTimePrompt(Prompt old) {
|
||||
super("0", "1", "2", "3", "4", "5", "6", "7", "8");
|
||||
oldPrompt = old;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
String menu = ChatColor.YELLOW + Lang.get("dateTimeTitle") + "\n";
|
||||
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "1. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeDay") + "\n";
|
||||
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "2. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeMonth") + "\n";
|
||||
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "3. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeYear") + "\n";
|
||||
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "4. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeHour") + "\n";
|
||||
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "5. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeMinute") + "\n";
|
||||
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "6. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeSecond") + "\n";
|
||||
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "7. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeZone") + "\n";
|
||||
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "8. " + ChatColor.RESET + "" + ChatColor.RED + Lang.get("cancel") + "\n";
|
||||
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "9. " + ChatColor.RESET + "" + ChatColor.GREEN + Lang.get("done") + "\n";
|
||||
return menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext cc, String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
//return new DayPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
//return new MonthPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
//return new YearPrompt();
|
||||
}
|
||||
try {
|
||||
return oldPrompt;
|
||||
} catch (Exception e) {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
}
|
||||
}
|
218
src/main/java/me/blackvein/quests/prompts/PlannerPrompt.java
Normal file
218
src/main/java/me/blackvein/quests/prompts/PlannerPrompt.java
Normal file
@ -0,0 +1,218 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.prompts;
|
||||
|
||||
import me.blackvein.quests.QuestFactory;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.FixedSetPrompt;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
|
||||
public class PlannerPrompt extends FixedSetPrompt {
|
||||
|
||||
final Quests quests;
|
||||
final QuestFactory factory;
|
||||
|
||||
public PlannerPrompt(Quests plugin, QuestFactory qf) {
|
||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
|
||||
quests = plugin;
|
||||
factory = qf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text;
|
||||
String lang = Lang.get("plannerTitle");
|
||||
lang = lang.replaceAll("<quest>", ChatColor.BLUE + (String) context.getSessionData(CK.Q_NAME));
|
||||
text = ChatColor.AQUA + lang + "\n";
|
||||
if (context.getSessionData(CK.PLN_START_DATE) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("schStart") + " " + ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("schStart") + " (" + Quests.getTime((Long) context.getSessionData(CK.PLN_START_DATE)) + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.PLN_END_DATE) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("schEnd") + " " + ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("schEnd") + " (" + Quests.getTime((Long) context.getSessionData(CK.PLN_END_DATE)) + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.PLN_REPEAT_CYCLE) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("schRepeat") + " " + ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("schRepeat") + " (" + Quests.getTime((Long) context.getSessionData(CK.PLN_REPEAT_CYCLE)) + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.PLN_COOLDOWN) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("schCooldown") + " " + ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("schCooldown") + " (" + Quests.getTime((Long) context.getSessionData(CK.PLN_COOLDOWN)) + ")\n";
|
||||
}
|
||||
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new StartPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
return new EndPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new RepeatPrompt();
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
return new CooldownPrompt();
|
||||
} else if (input.equalsIgnoreCase("5")) {
|
||||
return factory.returnToMenu();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private class StartPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("schStartPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new PlannerPrompt(quests, factory);
|
||||
}
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.PLN_START_DATE, null);
|
||||
}
|
||||
long delay;
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
delay = i * 1000;
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " " + Lang.get("stageEditorInvalidNumber"));
|
||||
return new StartPrompt();
|
||||
}
|
||||
if (delay < -1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
|
||||
} else if (delay == 0) {
|
||||
context.setSessionData(CK.PLN_START_DATE, null);
|
||||
} else if (delay != -1) {
|
||||
context.setSessionData(CK.PLN_START_DATE, delay);
|
||||
}
|
||||
return new PlannerPrompt(quests, factory);
|
||||
}
|
||||
}
|
||||
|
||||
private class EndPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("schEndPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new PlannerPrompt(quests, factory);
|
||||
}
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.PLN_END_DATE, null);
|
||||
}
|
||||
long delay;
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
delay = i * 1000;
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " " + Lang.get("stageEditorInvalidNumber"));
|
||||
return new EndPrompt();
|
||||
}
|
||||
if (delay < -1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
|
||||
} else if (delay == 0) {
|
||||
context.setSessionData(CK.PLN_END_DATE, null);
|
||||
} else if (delay != -1) {
|
||||
context.setSessionData(CK.PLN_END_DATE, delay);
|
||||
}
|
||||
return new PlannerPrompt(quests, factory);
|
||||
}
|
||||
}
|
||||
|
||||
private class RepeatPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("schRepeatPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new PlannerPrompt(quests, factory);
|
||||
}
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.PLN_REPEAT_CYCLE, null);
|
||||
}
|
||||
long delay;
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
delay = i * 1000;
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " " + Lang.get("stageEditorInvalidNumber"));
|
||||
return new RepeatPrompt();
|
||||
}
|
||||
if (delay < -1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
|
||||
} else if (delay == 0) {
|
||||
context.setSessionData(CK.PLN_REPEAT_CYCLE, null);
|
||||
} else if (delay != -1) {
|
||||
context.setSessionData(CK.PLN_REPEAT_CYCLE, delay);
|
||||
}
|
||||
return new PlannerPrompt(quests, factory);
|
||||
}
|
||||
}
|
||||
|
||||
private class CooldownPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("schCooldownPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new PlannerPrompt(quests, factory);
|
||||
}
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.PLN_COOLDOWN, null);
|
||||
}
|
||||
long delay;
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
delay = i * 1000;
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " " + Lang.get("stageEditorInvalidNumber"));
|
||||
return new CooldownPrompt();
|
||||
}
|
||||
if (delay < -1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
|
||||
} else if (delay == 0) {
|
||||
context.setSessionData(CK.PLN_COOLDOWN, null);
|
||||
} else if (delay != -1) {
|
||||
context.setSessionData(CK.PLN_COOLDOWN, delay);
|
||||
}
|
||||
return new PlannerPrompt(quests, factory);
|
||||
}
|
||||
}
|
||||
}
|
@ -128,7 +128,7 @@ public class QuestAcceptPrompt extends StringPrompt {
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + early);
|
||||
} else if (q.redoDelay < 0) {
|
||||
} else if (q.cooldownPlanner < 0) {
|
||||
String completed = Lang.get("questAlreadyCompleted");
|
||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + completed);
|
||||
|
@ -21,7 +21,6 @@ public class CK {
|
||||
public static final String Q_NAME = "questName";
|
||||
public static final String Q_ASK_MESSAGE = "askMessage";
|
||||
public static final String Q_FINISH_MESSAGE = "finishMessage";
|
||||
public static final String Q_REDO_DELAY = "redoDelay";
|
||||
public static final String Q_START_NPC = "npcStart";
|
||||
public static final String Q_START_BLOCK = "blockStart";
|
||||
public static final String Q_FAIL_MESSAGE = "failMessage";
|
||||
@ -44,22 +43,6 @@ public class CK {
|
||||
public static final String REQ_CUSTOM_DATA = "customReqData";
|
||||
public static final String REQ_CUSTOM_DATA_DESCRIPTIONS = "customReqDataDesc";
|
||||
public static final String REQ_CUSTOM_DATA_TEMP = "customReqDataTemp";
|
||||
// Rewards
|
||||
public static final String REW_MONEY = "moneyRew";
|
||||
public static final String REW_QUEST_POINTS = "questPointsRew";
|
||||
public static final String REW_ITEMS = "itemRews";
|
||||
public static final String REW_EXP = "expRew";
|
||||
public static final String REW_COMMAND = "commandRews";
|
||||
public static final String REW_PERMISSION = "permissionRews";
|
||||
public static final String REW_MCMMO_SKILLS = "mcMMOSkillRews";
|
||||
public static final String REW_MCMMO_AMOUNTS = "mcMMOSkillAmounts";
|
||||
public static final String REW_HEROES_CLASSES = "heroesClassRews";
|
||||
public static final String REW_HEROES_AMOUNTS = "heroesAmountRews";
|
||||
public static final String REW_PHAT_LOOTS = "phatLootRews";
|
||||
public static final String REW_CUSTOM = "customRews";
|
||||
public static final String REW_CUSTOM_DATA = "customRewData";
|
||||
public static final String REW_CUSTOM_DATA_DESCRIPTIONS = "customRewDataDesc";
|
||||
public static final String REW_CUSTOM_DATA_TEMP = "customRewDataTemp";
|
||||
// Stages
|
||||
public static final String S_BREAK_NAMES = "breakNames";
|
||||
public static final String S_BREAK_AMOUNTS = "breakAmounts";
|
||||
@ -122,6 +105,27 @@ public class CK {
|
||||
public static final String S_CUSTOM_OBJECTIVES_DATA = "customObjectiveData";
|
||||
public static final String S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS = "customObjectiveDataDescriptions";
|
||||
public static final String S_CUSTOM_OBJECTIVES_DATA_TEMP = "customObjectiveDataTemp";
|
||||
// Rewards
|
||||
public static final String REW_MONEY = "moneyRew";
|
||||
public static final String REW_QUEST_POINTS = "questPointsRew";
|
||||
public static final String REW_ITEMS = "itemRews";
|
||||
public static final String REW_EXP = "expRew";
|
||||
public static final String REW_COMMAND = "commandRews";
|
||||
public static final String REW_PERMISSION = "permissionRews";
|
||||
public static final String REW_MCMMO_SKILLS = "mcMMOSkillRews";
|
||||
public static final String REW_MCMMO_AMOUNTS = "mcMMOSkillAmounts";
|
||||
public static final String REW_HEROES_CLASSES = "heroesClassRews";
|
||||
public static final String REW_HEROES_AMOUNTS = "heroesAmountRews";
|
||||
public static final String REW_PHAT_LOOTS = "phatLootRews";
|
||||
public static final String REW_CUSTOM = "customRews";
|
||||
public static final String REW_CUSTOM_DATA = "customRewData";
|
||||
public static final String REW_CUSTOM_DATA_DESCRIPTIONS = "customRewDataDesc";
|
||||
public static final String REW_CUSTOM_DATA_TEMP = "customRewDataTemp";
|
||||
//Planner
|
||||
public static final String PLN_START_DATE = "startDatePln";
|
||||
public static final String PLN_END_DATE = "endDatePln";
|
||||
public static final String PLN_REPEAT_CYCLE = "repeatCyclePln";
|
||||
public static final String PLN_COOLDOWN = "cooldownPln";
|
||||
// Events
|
||||
public static final String E_OLD_EVENT = "oldEvent";
|
||||
public static final String E_NAME = "evtName";
|
||||
|
@ -99,9 +99,9 @@ public class ItemUtil {
|
||||
for (String arg : args) {
|
||||
if (arg.startsWith("name-")) {
|
||||
try {
|
||||
stack = new ItemStack(Material.matchMaterial(arg.substring(5)));
|
||||
stack = new ItemStack(Material.matchMaterial(arg.substring(5).toUpperCase()));
|
||||
} catch (NullPointerException npe) {
|
||||
Bukkit.getLogger().severe("[Quests] The item name \'" + arg.substring(5) + "\' is invalid. Make sure quests.yml is UTF-8 encoded");
|
||||
Bukkit.getLogger().severe("[Quests] The item name \'" + arg.substring(5).toUpperCase() + "\' is invalid. Make sure quests.yml is UTF-8 encoded");
|
||||
return null;
|
||||
}
|
||||
meta = stack.getItemMeta();
|
||||
|
@ -59,7 +59,6 @@ questEditorDelete: "Delete Quest"
|
||||
questEditorName: "Set name"
|
||||
questEditorAskMessage: "Set ask message"
|
||||
questEditorFinishMessage: "Set finish message"
|
||||
questEditorRedoDelay: "Set redo delay"
|
||||
questEditorNPCStart: "Set NPC start"
|
||||
questEditorBlockStart: "Set Block start"
|
||||
questEditorInitialEvent: "Set initial Event"
|
||||
@ -67,11 +66,11 @@ questEditorSetGUI: "Set GUI Item display"
|
||||
questEditorReqs: "Edit Requirements"
|
||||
questEditorStages: "Edit Stages"
|
||||
questEditorRews: "Edit Rewards"
|
||||
questEditorSched: "Edit Schedule"
|
||||
questEditorEnterQuestName: "Enter Quest name (<cancel>)"
|
||||
questEditorEditEnterQuestName: "Enter Quest name to edit (<cancel>)"
|
||||
questEditorEnterAskMessage: "Enter ask message (<cancel>)"
|
||||
questEditorEnterFinishMessage: "Enter finish message (<cancel>)"
|
||||
questEditorEnterRedoDelay: "Enter amount of time (in seconds), 0 to clear the redo delay or -1 to cancel"
|
||||
questEditorEnterNPCStart: "Enter NPC ID, -1 to clear the NPC start or -2 to cancel"
|
||||
questEditorEnterBlockStart: "Right-click on a block to use as a start point, <done>, <clear>, <cancel>"
|
||||
questEditorEnterInitialEvent: "Enter an Event name, <clear>, <cancel>"
|
||||
@ -553,6 +552,14 @@ rewCustomAlreadyAdded: "That custom reward has already been added!"
|
||||
rewCustomNotFound: "Custom reward module not found."
|
||||
rewCustomCleared: "Custom rewards cleared."
|
||||
rewNoPhat: "PhatLoots not installed"
|
||||
schStart: "Set start date"
|
||||
schEnd: "Set end date"
|
||||
schRepeat: "Set repeat cycle"
|
||||
schCooldown: "Set player cooldown"
|
||||
schStartPrompt: "Enter amount of time (in seconds), 0 to clear the start date or -1 to cancel"
|
||||
schEndPrompt: "Enter amount of time (in seconds), 0 to clear the end date or -1 to cancel"
|
||||
schRepeatPrompt: "Enter amount of time (in seconds), 0 to clear the repeat or -1 to cancel"
|
||||
schCooldownPrompt: "Enter amount of time (in seconds), 0 to clear the cooldown or -1 to cancel"
|
||||
itemCreateLoadHand: "Load item in hand"
|
||||
itemCreateSetName: "Set name"
|
||||
itemCreateSetAmount: "Set amount"
|
||||
@ -603,6 +610,7 @@ questEditTitle: "- Edit Quest -"
|
||||
questDeleteTitle: "- Delete Quest -"
|
||||
requirementsTitle: "- <quest> | Requirements -"
|
||||
rewardsTitle: "- <quest> | Rewards -"
|
||||
scheduleTitle: "- <quest> | Schedule -"
|
||||
itemRequirementsTitle: "- Item Requirements -"
|
||||
itemRewardsTitle: "- Item Rewards -"
|
||||
mcMMORequirementsTitle: "- mcMMO Requirements -"
|
||||
@ -621,6 +629,7 @@ eventTitle: "- Event -"
|
||||
completedQuestsTitle: "- Completed Quests -"
|
||||
topQuestersTitle: "- Top <number> Questers -"
|
||||
createItemTitle: "- Create Item -"
|
||||
dateTimeTitle: "- Date & Time -"
|
||||
enchantmentsTitle: "- Enchantments -"
|
||||
questGUITitle: "- GUI Item Display -"
|
||||
questRegionTitle: "- Quest Region -"
|
||||
@ -796,8 +805,13 @@ COLOR_RED: "Red"
|
||||
COLOR_SILVER: "Silver"
|
||||
COLOR_WHITE: "White"
|
||||
COLOR_YELLOW: "Yellow"
|
||||
timeZone: "Time zone"
|
||||
timeDay: "Day"
|
||||
timeDays: "Days"
|
||||
timeMonth: "Month"
|
||||
timeMonths: "Months"
|
||||
timeYear: "Year"
|
||||
timeYears: "Years"
|
||||
timeHour: "Hour"
|
||||
timeHours: "Hours"
|
||||
timeMinute: "Minute"
|
||||
|
Loading…
Reference in New Issue
Block a user