Add subcommand language toggle. Possibly BREAKING cleanup! Bump version

This commit is contained in:
HappyPikachu 2018-03-08 18:25:56 -05:00
parent 189ae08e92
commit 36dbf1b76e
16 changed files with 521 additions and 432 deletions

View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId> <groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId> <artifactId>quests</artifactId>
<version>3.2.6</version> <version>3.2.7</version>
<name>quests</name> <name>quests</name>
<url>https://github.com/FlyingPikachu/Quests/</url> <url>https://github.com/FlyingPikachu/Quests/</url>
<packaging>jar</packaging> <packaging>jar</packaging>

View File

@ -20,6 +20,7 @@ import org.bukkit.event.Listener;
public abstract class CustomObjective implements Listener { public abstract class CustomObjective implements Listener {
private Quests plugin = Quests.getPlugin(Quests.class);
private String name = null; private String name = null;
private String author = null; private String author = null;
public final Map<String, Object> datamap = new HashMap<String, Object>(); public final Map<String, Object> datamap = new HashMap<String, Object>();
@ -94,8 +95,8 @@ public abstract class CustomObjective implements Listener {
this.enableCount = enableCount; this.enableCount = enableCount;
} }
public static Map<String, Object> getDatamap(Player player, CustomObjective obj, Quest quest) { public Map<String, Object> getDatamap(Player player, CustomObjective obj, Quest quest) {
Quester quester = Quests.getInstance().getQuester(player.getUniqueId()); Quester quester = plugin.getQuester(player.getUniqueId());
if (quester != null) { if (quester != null) {
Stage currentStage = quester.getCurrentStage(quest); Stage currentStage = quester.getCurrentStage(quest);
if (currentStage == null) if (currentStage == null)
@ -116,8 +117,8 @@ public abstract class CustomObjective implements Listener {
return null; return null;
} }
public static void incrementObjective(Player player, CustomObjective obj, int count, Quest quest) { public void incrementObjective(Player player, CustomObjective obj, int count, Quest quest) {
Quester quester = Quests.getInstance().getQuester(player.getUniqueId()); Quester quester = plugin.getQuester(player.getUniqueId());
if (quester != null) { if (quester != null) {
// Check if the player has Quest with objective // Check if the player has Quest with objective
boolean hasQuest = false; boolean hasQuest = false;
@ -130,9 +131,9 @@ public abstract class CustomObjective implements Listener {
if (hasQuest && quester.hasCustomObjective(quest, obj.getName())) { if (hasQuest && quester.hasCustomObjective(quest, obj.getName())) {
if (quester.getQuestData(quest).customObjectiveCounts.containsKey(obj.getName())) { if (quester.getQuestData(quest).customObjectiveCounts.containsKey(obj.getName())) {
int old = quester.getQuestData(quest).customObjectiveCounts.get(obj.getName()); int old = quester.getQuestData(quest).customObjectiveCounts.get(obj.getName());
Quests.getInstance().getQuester(player.getUniqueId()).getQuestData(quest).customObjectiveCounts.put(obj.getName(), old + count); plugin.getInstance().getQuester(player.getUniqueId()).getQuestData(quest).customObjectiveCounts.put(obj.getName(), old + count);
} else { } else {
Quests.getInstance().getQuester(player.getUniqueId()).getQuestData(quest).customObjectiveCounts.put(obj.getName(), count); plugin.getInstance().getQuester(player.getUniqueId()).getQuestData(quest).customObjectiveCounts.put(obj.getName(), count);
} }
int index = -1; int index = -1;
for (int i = 0; i < quester.getCurrentStage(quest).customObjectives.size(); i++) { for (int i = 0; i < quester.getCurrentStage(quest).customObjectives.size(); i++) {

View File

@ -46,13 +46,13 @@ public class NpcEffectThread implements Runnable {
List<Entity> nearby = player.getNearbyEntities(32.0, 32.0, 32.0); List<Entity> nearby = player.getNearbyEntities(32.0, 32.0, 32.0);
if (nearby.isEmpty() == false) { if (nearby.isEmpty() == false) {
for (Entity e : nearby) { for (Entity e : nearby) {
if (plugin.citizens != null) { if (Quests.citizens != null) {
if (plugin.citizens.getNPCRegistry().isNPC(e)) { if (Quests.citizens.getNPCRegistry().isNPC(e)) {
NPC npc = plugin.citizens.getNPCRegistry().getNPC(e); NPC npc = Quests.citizens.getNPCRegistry().getNPC(e);
if (plugin.hasQuest(npc, quester)) { if (plugin.hasQuest(npc, quester)) {
showEffect(player, npc, Quests.effect); showEffect(player, npc, plugin.effect);
} else if (plugin.hasCompletedRedoableQuest(npc, quester)) { } else if (plugin.hasCompletedRedoableQuest(npc, quester)) {
showEffect(player, npc, Quests.redoEffect); showEffect(player, npc, plugin.redoEffect);
} }
} }
} }
@ -62,7 +62,7 @@ public class NpcEffectThread implements Runnable {
} }
// effectType is either effectType or Quests.repeatEffect // effectType is either effectType or Quests.repeatEffect
private static void showEffect(Player player, NPC npc, String effectType) { private void showEffect(Player player, NPC npc, String effectType) {
if (Bukkit.getBukkitVersion().contains("1.7.9")) { if (Bukkit.getBukkitVersion().contains("1.7.9")) {
showEffect_R3(player, npc, effectType); showEffect_R3(player, npc, effectType);
} else if (Bukkit.getBukkitVersion().contains("1.7.10")) { } else if (Bukkit.getBukkitVersion().contains("1.7.10")) {
@ -86,7 +86,7 @@ public class NpcEffectThread implements Runnable {
} }
} }
private static void showEffect_1_12_R1(Player player, NPC npc, String effectType) { private void showEffect_1_12_R1(Player player, NPC npc, String effectType) {
// Get and set eye location, because npc.getBukkitEntity() is deprecated. // Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation(); Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5); eyeLoc.setY(eyeLoc.getY() + 1.5);
@ -173,12 +173,12 @@ public class NpcEffectThread implements Runnable {
try { try {
Eff_1_12_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); Eff_1_12_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) { } catch (Exception e) {
Quests.getInstance().getLogger().info(effectType + " is not a valid effect name!"); plugin.getInstance().getLogger().info(effectType + " is not a valid effect name!");
} }
} }
} }
private static void showEffect_1_11_R1(Player player, NPC npc, String effectType) { private void showEffect_1_11_R1(Player player, NPC npc, String effectType) {
// Get and set eye location, because npc.getBukkitEntity() is deprecated. // Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation(); Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5); eyeLoc.setY(eyeLoc.getY() + 1.5);
@ -265,12 +265,12 @@ public class NpcEffectThread implements Runnable {
try { try {
Eff_1_11_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); Eff_1_11_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) { } catch (Exception e) {
Quests.getInstance().getLogger().info(effectType + " is not a valid effect name!"); plugin.getLogger().info(effectType + " is not a valid effect name!");
} }
} }
} }
private static void showEffect_1_10_R1(Player player, NPC npc, String effectType) { private void showEffect_1_10_R1(Player player, NPC npc, String effectType) {
// Get and set eye location, because npc.getBukkitEntity() is deprecated. // Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation(); Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5); eyeLoc.setY(eyeLoc.getY() + 1.5);
@ -357,12 +357,12 @@ public class NpcEffectThread implements Runnable {
try { try {
Eff_1_10_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); Eff_1_10_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) { } catch (Exception e) {
Quests.getInstance().getLogger().info(effectType + " is not a valid effect name!"); plugin.getLogger().info(effectType + " is not a valid effect name!");
} }
} }
} }
private static void showEffect_1_9_R2(Player player, NPC npc, String effectType) { private void showEffect_1_9_R2(Player player, NPC npc, String effectType) {
// Get and set eye location, because npc.getBukkitEntity() is deprecated. // Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation(); Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5); eyeLoc.setY(eyeLoc.getY() + 1.5);
@ -449,12 +449,12 @@ public class NpcEffectThread implements Runnable {
try { try {
Eff_1_9_R2.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); Eff_1_9_R2.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) { } catch (Exception e) {
Quests.getInstance().getLogger().info(effectType + " is not a valid effect name!"); plugin.getLogger().info(effectType + " is not a valid effect name!");
} }
} }
} }
private static void showEffect_1_9_R1(Player player, NPC npc, String effectType) { private void showEffect_1_9_R1(Player player, NPC npc, String effectType) {
// Get and set eye location, because npc.getBukkitEntity() is deprecated. // Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation(); Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5); eyeLoc.setY(eyeLoc.getY() + 1.5);
@ -541,12 +541,12 @@ public class NpcEffectThread implements Runnable {
try { try {
Eff_1_9_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); Eff_1_9_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) { } catch (Exception e) {
Quests.getInstance().getLogger().info(effectType + " is not a valid effect name!"); plugin.getLogger().info(effectType + " is not a valid effect name!");
} }
} }
} }
private static void showEffect_1_8_R3(Player player, NPC npc, String effectType) { private void showEffect_1_8_R3(Player player, NPC npc, String effectType) {
// Get and set eye location, because npc.getBukkitEntity() is deprecated. // Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation(); Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5); eyeLoc.setY(eyeLoc.getY() + 1.5);
@ -633,12 +633,12 @@ public class NpcEffectThread implements Runnable {
try { try {
Eff_1_8_R3.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); Eff_1_8_R3.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) { } catch (Exception e) {
Quests.getInstance().getLogger().info(effectType + " is not a valid effect name!"); plugin.getLogger().info(effectType + " is not a valid effect name!");
} }
} }
} }
private static void showEffect_1_8_R2(Player player, NPC npc, String effectType) { private void showEffect_1_8_R2(Player player, NPC npc, String effectType) {
// Get and set eye location, because npc.getBukkitEntity() is deprecated. // Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation(); Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5); eyeLoc.setY(eyeLoc.getY() + 1.5);
@ -725,12 +725,12 @@ public class NpcEffectThread implements Runnable {
try { try {
Eff_1_8_R2.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); Eff_1_8_R2.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) { } catch (Exception e) {
Quests.getInstance().getLogger().info(effectType + " is not a valid effect name!"); plugin.getLogger().info(effectType + " is not a valid effect name!");
} }
} }
} }
private static void showEffect_1_8_R1(Player player, NPC npc, String effectType) { private void showEffect_1_8_R1(Player player, NPC npc, String effectType) {
// Get and set eye location, because npc.getBukkitEntity() is deprecated. // Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation(); Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5); eyeLoc.setY(eyeLoc.getY() + 1.5);
@ -817,12 +817,12 @@ public class NpcEffectThread implements Runnable {
try { try {
Eff_1_8_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); Eff_1_8_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) { } catch (Exception e) {
Quests.getInstance().getLogger().info(effectType + " is not a valid effect name!"); plugin.getLogger().info(effectType + " is not a valid effect name!");
} }
} }
} }
private static void showEffect_R4(Player player, NPC npc, String effectType) { private void showEffect_R4(Player player, NPC npc, String effectType) {
// Get and set eye location, because npc.getBukkitEntity() is deprecated. // Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation(); Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5); eyeLoc.setY(eyeLoc.getY() + 1.5);
@ -909,12 +909,12 @@ public class NpcEffectThread implements Runnable {
try { try {
Eff_1_7_R4.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3); Eff_1_7_R4.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3);
} catch (Exception e) { } catch (Exception e) {
Quests.getInstance().getLogger().info(effectType + " is not a valid effect name!"); plugin.getLogger().info(effectType + " is not a valid effect name!");
} }
} }
} }
private static void showEffect_R3(Player player, NPC npc, String effectType) { private void showEffect_R3(Player player, NPC npc, String effectType) {
// Get and set eye location, because npc.getBukkitEntity() is deprecated. // Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation(); Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5); eyeLoc.setY(eyeLoc.getY() + 1.5);
@ -1002,7 +1002,7 @@ public class NpcEffectThread implements Runnable {
try { try {
Eff_1_7_R3.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3); Eff_1_7_R3.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3);
} catch (Exception e) { } catch (Exception e) {
Quests.getInstance().getLogger().info(effectType + " is not a valid effect name!"); plugin.getLogger().info(effectType + " is not a valid effect name!");
} }
} }
} }

View File

@ -110,7 +110,7 @@ public class NpcListener implements Listener {
if (quester.currentQuests.containsKey(q)) if (quester.currentQuests.containsKey(q))
continue; continue;
if (q.npcStart != null && q.npcStart.getId() == evt.getNPC().getId()) { if (q.npcStart != null && q.npcStart.getId() == evt.getNPC().getId()) {
if (Quests.ignoreLockedQuests && (quester.completedQuests.contains(q.name) == false || q.redoDelay > -1)) { if (plugin.ignoreLockedQuests && (quester.completedQuests.contains(q.name) == false || q.redoDelay > -1)) {
if (q.testRequirements(quester)) { if (q.testRequirements(quester)) {
npcQuests.add(q); npcQuests.add(q);
} }
@ -131,7 +131,7 @@ public class NpcListener implements Listener {
} else if (npcQuests.size() == 1) { } else if (npcQuests.size() == 1) {
Quest q = npcQuests.get(0); Quest q = npcQuests.get(0);
if (!quester.completedQuests.contains(q.name)) { if (!quester.completedQuests.contains(q.name)) {
if (quester.currentQuests.size() < Quests.maxQuests || Quests.maxQuests < 1) { if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
quester.questToTake = q.name; quester.questToTake = q.name;
String s = extracted(quester); String s = extracted(quester);
for (String msg : s.split("<br>")) { for (String msg : s.split("<br>")) {
@ -140,10 +140,10 @@ public class NpcListener implements Listener {
plugin.conversationFactory.buildConversation(player).begin(); plugin.conversationFactory.buildConversation(player).begin();
} else if (quester.currentQuests.containsKey(q) == false) { } else if (quester.currentQuests.containsKey(q) == false) {
String msg = Lang.get(player, "questMaxAllowed"); String msg = Lang.get(player, "questMaxAllowed");
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests)); msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
player.sendMessage(ChatColor.YELLOW + msg); player.sendMessage(ChatColor.YELLOW + msg);
} }
} else if (quester.currentQuests.size() < Quests.maxQuests || Quests.maxQuests < 1) { } else if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
if (quester.getDifference(q) > 0) { if (quester.getDifference(q) > 0) {
String early = Lang.get(player, "questTooEarly"); String early = Lang.get(player, "questTooEarly");
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW); early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
@ -163,7 +163,7 @@ public class NpcListener implements Listener {
} }
} else if (quester.currentQuests.containsKey(q) == false) { } else if (quester.currentQuests.containsKey(q) == false) {
String msg = Lang.get(player, "questMaxAllowed"); String msg = Lang.get(player, "questMaxAllowed");
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests)); msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
player.sendMessage(ChatColor.YELLOW + msg); player.sendMessage(ChatColor.YELLOW + msg);
} }
} else if (npcQuests.isEmpty()) { } else if (npcQuests.isEmpty()) {
@ -192,7 +192,7 @@ public class NpcListener implements Listener {
if (evt.getNPC().getEntity().getLastDamageCause().getEntity() instanceof Player) { if (evt.getNPC().getEntity().getLastDamageCause().getEntity() instanceof Player) {
Player player = (Player) evt.getNPC().getEntity().getLastDamageCause().getEntity(); Player player = (Player) evt.getNPC().getEntity().getLastDamageCause().getEntity();
boolean okay = true; boolean okay = true;
if (plugin.citizens != null) { if (Quests.citizens != null) {
if (CitizensAPI.getNPCRegistry().isNPC(player)) { if (CitizensAPI.getNPCRegistry().isNPC(player)) {
okay = false; okay = false;
} }
@ -208,8 +208,8 @@ public class NpcListener implements Listener {
} }
} else if (damager instanceof Player) { } else if (damager instanceof Player) {
boolean okay = true; boolean okay = true;
if (plugin.citizens != null) { if (Quests.citizens != null) {
if (plugin.citizens.getNPCRegistry().isNPC(damager)) { if (Quests.citizens.getNPCRegistry().isNPC(damager)) {
okay = false; okay = false;
} }
} }

View File

@ -108,9 +108,9 @@ public class PlayerListener implements Listener {
for (Quest quest : plugin.quests) { for (Quest quest : plugin.quests) {
if (quest.guiDisplay != null) { if (quest.guiDisplay != null) {
if (ItemUtil.compareItems(clicked, quest.guiDisplay, false) == 0) { if (ItemUtil.compareItems(clicked, quest.guiDisplay, false) == 0) {
if (quester.currentQuests.size() >= Quests.maxQuests && Quests.maxQuests > 0) { if (quester.currentQuests.size() >= plugin.maxQuests && plugin.maxQuests > 0) {
String msg = Lang.get(player, "questMaxAllowed"); String msg = Lang.get(player, "questMaxAllowed");
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests)); msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
player.sendMessage(ChatColor.YELLOW + msg); player.sendMessage(ChatColor.YELLOW + msg);
} else if (quester.completedQuests.contains(quest.name) && quest.redoDelay < 0) { } else if (quester.completedQuests.contains(quest.name) && quest.redoDelay < 0) {
String completed = Lang.get(player, "questAlreadyCompleted"); String completed = Lang.get(player, "questAlreadyCompleted");
@ -241,9 +241,9 @@ public class PlayerListener implements Listener {
for (final Quest q : plugin.quests) { for (final Quest q : plugin.quests) {
if (q.blockStart != null) { if (q.blockStart != null) {
if (q.blockStart.equals(evt.getClickedBlock().getLocation())) { if (q.blockStart.equals(evt.getClickedBlock().getLocation())) {
if (quester.currentQuests.size() >= Quests.maxQuests && Quests.maxQuests > 0) { if (quester.currentQuests.size() >= plugin.maxQuests && plugin.maxQuests > 0) {
String msg = Lang.get(player, "questMaxAllowed"); String msg = Lang.get(player, "questMaxAllowed");
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests)); msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
player.sendMessage(ChatColor.YELLOW + msg); player.sendMessage(ChatColor.YELLOW + msg);
} else { } else {
if (quester.completedQuests.contains(q.name)) { if (quester.completedQuests.contains(q.name)) {
@ -492,7 +492,7 @@ public class PlayerListener implements Listener {
return; return;
} }
if (damager instanceof Player) { if (damager instanceof Player) {
if (plugin.citizens != null) { if (Quests.citizens != null) {
if (CitizensAPI.getNPCRegistry().isNPC(target)) { if (CitizensAPI.getNPCRegistry().isNPC(target)) {
Quester quester = plugin.getQuester(damager.getUniqueId()); Quester quester = plugin.getQuester(damager.getUniqueId());
for (Quest quest : quester.currentQuests.keySet()) { for (Quest quest : quester.currentQuests.keySet()) {
@ -642,11 +642,11 @@ public class PlayerListener implements Listener {
quester.id = evt.getPlayer().getUniqueId(); quester.id = evt.getPlayer().getUniqueId();
if (new File(plugin.getDataFolder(), "data" + File.separator + quester.id + ".yml").exists()) { if (new File(plugin.getDataFolder(), "data" + File.separator + quester.id + ".yml").exists()) {
quester.loadData(); quester.loadData();
} else if (Quests.genFilesOnJoin) { } else if (plugin.genFilesOnJoin) {
quester.saveData(); quester.saveData();
} }
plugin.questers.put(evt.getPlayer().getUniqueId(), quester); plugin.questers.put(evt.getPlayer().getUniqueId(), quester);
if (Quests.useCompass) { if (plugin.useCompass) {
quester.resetCompass(); quester.resetCompass();
} }
for (String s : quester.completedQuests) { for (String s : quester.completedQuests) {
@ -710,7 +710,7 @@ public class PlayerListener implements Listener {
} }
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) { if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
boolean isPlayer = true; boolean isPlayer = true;
if (plugin.citizens != null) { if (Quests.citizens != null) {
if (CitizensAPI.getNPCRegistry().isNPC(evt.getPlayer())) { if (CitizensAPI.getNPCRegistry().isNPC(evt.getPlayer())) {
isPlayer = false; isPlayer = false;
} }

View File

@ -98,7 +98,7 @@ public class Quest {
if (stageCompleteMessage != null) { if (stageCompleteMessage != null) {
q.getPlayer().sendMessage(Quests.parseString(stageCompleteMessage, this)); q.getPlayer().sendMessage(Quests.parseString(stageCompleteMessage, this));
} }
if (Quests.useCompass) { if (plugin.useCompass) {
q.resetCompass(); q.resetCompass();
q.findCompassTarget(); q.findCompassTarget();
} }
@ -165,7 +165,7 @@ public class Quest {
} }
public boolean updateCompass(Quester quester, Stage nextStage) { public boolean updateCompass(Quester quester, Stage nextStage) {
if (!Quests.useCompass) if (!plugin.useCompass)
return false; return false;
Location targetLocation = null; Location targetLocation = null;
if (nextStage == null) { if (nextStage == null) {

View File

@ -58,7 +58,7 @@ import net.citizensnpcs.api.CitizensAPI;
public class QuestFactory implements ConversationAbandonedListener { public class QuestFactory implements ConversationAbandonedListener {
public Quests quests; public final Quests plugin;
Map<UUID, Quest> editSessions = new HashMap<UUID, Quest>(); Map<UUID, Quest> editSessions = new HashMap<UUID, Quest>();
Map<UUID, Block> selectedBlockStarts = new HashMap<UUID, Block>(); Map<UUID, Block> selectedBlockStarts = new HashMap<UUID, Block>();
public Map<UUID, Block> selectedKillLocations = new HashMap<UUID, Block>(); public Map<UUID, Block> selectedKillLocations = new HashMap<UUID, Block>();
@ -68,9 +68,8 @@ public class QuestFactory implements ConversationAbandonedListener {
ConversationFactory convoCreator; ConversationFactory convoCreator;
File questsFile; File questsFile;
// TODO - @SuppressWarnings("LeakingThisInConstructor")
public QuestFactory(Quests plugin) { public QuestFactory(Quests plugin) {
quests = plugin; this.plugin = plugin;
questsFile = new File(plugin.getDataFolder(), "quests.yml"); questsFile = new File(plugin.getDataFolder(), "quests.yml");
// Ensure to initialize convoCreator last, to ensure that 'this' is fully initialized before it is passed // Ensure to initialize convoCreator last, to ensure that 'this' is fully initialized before it is passed
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false).withFirstPrompt(new MenuPrompt()).withTimeout(3600).thatExcludesNonPlayersWithMessage("Console may not perform this operation!").addConversationAbandonedListener(this); this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false).withFirstPrompt(new MenuPrompt()).withTimeout(3600).thatExcludesNonPlayersWithMessage("Console may not perform this operation!").addConversationAbandonedListener(this);
@ -160,19 +159,19 @@ public class QuestFactory implements ConversationAbandonedListener {
} else { } else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorRedoDelay") + " (" + Quests.getTime((Long) context.getSessionData(CK.Q_REDO_DELAY)) + ")\n"; 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) { 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 + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + Lang.get("noneSet") + ")\n";
} else if (quests.citizens != null) { } 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 + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + CitizensAPI.getNPCRegistry().getById((Integer) context.getSessionData(CK.Q_START_NPC)).getName() + ")\n";
} }
if (context.getSessionData(CK.Q_START_BLOCK) == null) { if (context.getSessionData(CK.Q_START_BLOCK) == null) {
if (quests.citizens != null) { if (Quests.citizens != null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + Lang.get("noneSet") + ")\n";
} else { } 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 { } else {
if (quests.citizens != null) { if (Quests.citizens != null) {
Location l = (Location) context.getSessionData(CK.Q_START_BLOCK); 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"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")\n";
} else { } else {
@ -182,13 +181,13 @@ public class QuestFactory implements ConversationAbandonedListener {
} }
if (Quests.worldGuard != null) { if (Quests.worldGuard != null) {
if (context.getSessionData(CK.Q_REGION) == null) { if (context.getSessionData(CK.Q_REGION) == null) {
if (quests.citizens != null) { if (Quests.citizens != null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + Lang.get("noneSet") + ")\n";
} else { } 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 { } else {
if (quests.citizens != null) { if (Quests.citizens != null) {
String s = (String) context.getSessionData(CK.Q_REGION); 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"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + ChatColor.GREEN + s + ChatColor.YELLOW + ")\n";
} else { } else {
@ -197,20 +196,20 @@ public class QuestFactory implements ConversationAbandonedListener {
} }
} }
} else { } else {
if (quests.citizens != null) { if (Quests.citizens != null) {
text += ChatColor.GRAY + "7 - " + Lang.get("questWGSetRegion") + " (" + Lang.get("questWGNotInstalled") + ")\n"; text += ChatColor.GRAY + "7 - " + Lang.get("questWGSetRegion") + " (" + Lang.get("questWGNotInstalled") + ")\n";
} else { } 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 (context.getSessionData(CK.Q_INITIAL_EVENT) == null) {
if (quests.citizens != null) { if (Quests.citizens != null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + Lang.get("noneSet") + ")\n";
} else { } 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 { } else {
if (quests.citizens != null) { if (Quests.citizens != null) {
String s = (String) context.getSessionData(CK.Q_INITIAL_EVENT); String s = (String) context.getSessionData(CK.Q_INITIAL_EVENT);
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + s + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + s + ")\n";
} else { } else {
@ -218,7 +217,7 @@ public class QuestFactory implements ConversationAbandonedListener {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + s + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + s + ")\n";
} }
} }
if (quests.citizens != null) { if (Quests.citizens != null) {
if (context.getSessionData(CK.Q_GUIDISPLAY) == 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"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("noneSet") + ")\n";
} else { } else {
@ -228,27 +227,27 @@ public class QuestFactory implements ConversationAbandonedListener {
} else { } else {
text += ChatColor.GRAY + "8 - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("questCitNotInstalled") + ")\n"; text += ChatColor.GRAY + "8 - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("questCitNotInstalled") + ")\n";
} }
if (quests.citizens != null) { if (Quests.citizens != null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.DARK_AQUA + " - " + Lang.get("questEditorReqs") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.DARK_AQUA + " - " + Lang.get("questEditorReqs") + "\n";
} else { } else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.DARK_AQUA + " - " + Lang.get("questEditorReqs") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.DARK_AQUA + " - " + Lang.get("questEditorReqs") + "\n";
} }
if (quests.citizens != null) { if (Quests.citizens != null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.LIGHT_PURPLE + " - " + Lang.get("questEditorStages") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.LIGHT_PURPLE + " - " + Lang.get("questEditorStages") + "\n";
} else { } else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.LIGHT_PURPLE + " - " + Lang.get("questEditorStages") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.LIGHT_PURPLE + " - " + Lang.get("questEditorStages") + "\n";
} }
if (quests.citizens != null) { if (Quests.citizens != null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("questEditorRews") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("questEditorRews") + "\n";
} else { } else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("questEditorRews") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("questEditorRews") + "\n";
} }
if (quests.citizens != null) { if (Quests.citizens != null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("save") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("save") + "\n";
} else { } else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("save") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("save") + "\n";
} }
if (quests.citizens != null) { if (Quests.citizens != null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "14" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("exit") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "14" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("exit") + "\n";
} else { } else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("exit") + "\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("exit") + "\n";
@ -267,14 +266,14 @@ public class QuestFactory implements ConversationAbandonedListener {
} else if (input.equalsIgnoreCase("4")) { } else if (input.equalsIgnoreCase("4")) {
return new RedoDelayPrompt(); return new RedoDelayPrompt();
} else if (input.equalsIgnoreCase("5")) { } else if (input.equalsIgnoreCase("5")) {
if (quests.citizens != null) { if (Quests.citizens != null) {
return new SetNpcStartPrompt(); return new SetNpcStartPrompt();
} else { } else {
selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null); selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
return new BlockStartPrompt(); return new BlockStartPrompt();
} }
} else if (input.equalsIgnoreCase("6")) { } else if (input.equalsIgnoreCase("6")) {
if (quests.citizens != null) { if (Quests.citizens != null) {
selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null); selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
return new BlockStartPrompt(); return new BlockStartPrompt();
} else if (Quests.worldGuard != null) { } else if (Quests.worldGuard != null) {
@ -283,51 +282,51 @@ public class QuestFactory implements ConversationAbandonedListener {
return new CreateMenuPrompt(); return new CreateMenuPrompt();
} }
} else if (input.equalsIgnoreCase("7")) { } else if (input.equalsIgnoreCase("7")) {
if (quests.citizens != null && Quests.worldGuard != null) { if (Quests.citizens != null && Quests.worldGuard != null) {
return new RegionPrompt(); return new RegionPrompt();
} else if (quests.citizens != null) { } else if (Quests.citizens != null) {
return new CreateMenuPrompt(); return new CreateMenuPrompt();
} else { } else {
return new InitialEventPrompt(); return new InitialEventPrompt();
} }
} else if (input.equalsIgnoreCase("8")) { } else if (input.equalsIgnoreCase("8")) {
if (quests.citizens != null) { if (Quests.citizens != null) {
return new InitialEventPrompt(); return new InitialEventPrompt();
} else { } else {
return new GUIDisplayPrompt(); return new GUIDisplayPrompt();
} }
} else if (input.equalsIgnoreCase("9")) { } else if (input.equalsIgnoreCase("9")) {
if (quests.citizens != null) { if (Quests.citizens != null) {
return new GUIDisplayPrompt(); return new GUIDisplayPrompt();
} else { } else {
return new RequirementsPrompt(quests, QuestFactory.this); return new RequirementsPrompt(plugin, QuestFactory.this);
} }
} else if (input.equalsIgnoreCase("10")) { } else if (input.equalsIgnoreCase("10")) {
if (quests.citizens != null) { if (Quests.citizens != null) {
return new RequirementsPrompt(quests, QuestFactory.this); return new RequirementsPrompt(plugin, QuestFactory.this);
} else { } else {
return new StagesPrompt(QuestFactory.this); return new StagesPrompt(QuestFactory.this);
} }
} else if (input.equalsIgnoreCase("11")) { } else if (input.equalsIgnoreCase("11")) {
if (quests.citizens != null) { if (Quests.citizens != null) {
return new StagesPrompt(QuestFactory.this); return new StagesPrompt(QuestFactory.this);
} else { } else {
return new RewardsPrompt(quests, QuestFactory.this); return new RewardsPrompt(plugin, QuestFactory.this);
} }
} else if (input.equalsIgnoreCase("12")) { } else if (input.equalsIgnoreCase("12")) {
if (quests.citizens != null) { if (Quests.citizens != null) {
return new RewardsPrompt(quests, QuestFactory.this); return new RewardsPrompt(plugin, QuestFactory.this);
} else { } else {
return new SavePrompt(); return new SavePrompt();
} }
} else if (input.equalsIgnoreCase("13")) { } else if (input.equalsIgnoreCase("13")) {
if (quests.citizens != null) { if (Quests.citizens != null) {
return new SavePrompt(); return new SavePrompt();
} else { } else {
return new ExitPrompt(); return new ExitPrompt();
} }
} else if (input.equalsIgnoreCase("14")) { } else if (input.equalsIgnoreCase("14")) {
if (quests.citizens != null) { if (Quests.citizens != null) {
return new ExitPrompt(); return new ExitPrompt();
} else { } else {
return new CreateMenuPrompt(); return new CreateMenuPrompt();
@ -342,7 +341,7 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String s = ChatColor.GOLD + Lang.get("questEditTitle") + "\n"; String s = ChatColor.GOLD + Lang.get("questEditTitle") + "\n";
for (Quest q : quests.getQuests()) { for (Quest q : plugin.getQuests()) {
s += ChatColor.GRAY + "- " + ChatColor.YELLOW + q.getName() + "\n"; s += ChatColor.GRAY + "- " + ChatColor.YELLOW + q.getName() + "\n";
} }
return s + ChatColor.GOLD + Lang.get("questEditorEditEnterQuestName"); return s + ChatColor.GOLD + Lang.get("questEditorEditEnterQuestName");
@ -351,19 +350,19 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override @Override
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
for (Quest q : quests.getQuests()) { for (Quest q : plugin.getQuests()) {
if (q.getName().equalsIgnoreCase(input)) { if (q.getName().equalsIgnoreCase(input)) {
loadQuest(context, q); loadQuest(context, q);
return new CreateMenuPrompt(); return new CreateMenuPrompt();
} }
} }
for (Quest q : quests.getQuests()) { for (Quest q : plugin.getQuests()) {
if (q.getName().toLowerCase().startsWith(input.toLowerCase())) { if (q.getName().toLowerCase().startsWith(input.toLowerCase())) {
loadQuest(context, q); loadQuest(context, q);
return new CreateMenuPrompt(); return new CreateMenuPrompt();
} }
} }
for (Quest q : quests.getQuests()) { for (Quest q : plugin.getQuests()) {
if (q.getName().toLowerCase().contains(input.toLowerCase())) { if (q.getName().toLowerCase().contains(input.toLowerCase())) {
loadQuest(context, q); loadQuest(context, q);
return new CreateMenuPrompt(); return new CreateMenuPrompt();
@ -389,7 +388,7 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override @Override
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
for (Quest q : quests.quests) { for (Quest q : plugin.quests) {
if (q.name.equalsIgnoreCase(input)) { if (q.name.equalsIgnoreCase(input)) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNameExists")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNameExists"));
return new QuestNamePrompt(); return new QuestNamePrompt();
@ -488,7 +487,7 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override @Override
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
for (Quest q : quests.quests) { for (Quest q : plugin.quests) {
if (q.name.equalsIgnoreCase(input)) { if (q.name.equalsIgnoreCase(input)) {
String s = null; String s = null;
if (context.getSessionData(CK.ED_QUEST_EDIT) != null) { if (context.getSessionData(CK.ED_QUEST_EDIT) != null) {
@ -565,10 +564,10 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.DARK_GREEN + Lang.get("eventTitle") + "\n"; String text = ChatColor.DARK_GREEN + Lang.get("eventTitle") + "\n";
if (quests.events.isEmpty()) { if (plugin.events.isEmpty()) {
text += ChatColor.RED + "- " + Lang.get("none"); text += ChatColor.RED + "- " + Lang.get("none");
} else { } else {
for (Event e : quests.events) { for (Event e : plugin.events) {
text += ChatColor.GREEN + "- " + e.getName() + "\n"; text += ChatColor.GREEN + "- " + e.getName() + "\n";
} }
} }
@ -580,7 +579,7 @@ public class QuestFactory implements ConversationAbandonedListener {
Player player = (Player) context.getForWhom(); Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Event found = null; Event found = null;
for (Event e : quests.events) { for (Event e : plugin.events) {
if (e.getName().equalsIgnoreCase(input)) { if (e.getName().equalsIgnoreCase(input)) {
found = e; found = e;
break; break;
@ -614,7 +613,7 @@ public class QuestFactory implements ConversationAbandonedListener {
if (context.getSessionData("tempStack") != null) { if (context.getSessionData("tempStack") != null) {
ItemStack stack = (ItemStack) context.getSessionData("tempStack"); ItemStack stack = (ItemStack) context.getSessionData("tempStack");
boolean failed = false; boolean failed = false;
for (Quest quest : quests.quests) { for (Quest quest : plugin.quests) {
if (quest.guiDisplay != null) { if (quest.guiDisplay != null) {
if (ItemUtil.compareItems(stack, quest.guiDisplay, false) == 0) { if (ItemUtil.compareItems(stack, quest.guiDisplay, false) == 0) {
String error = Lang.get("questGUIError"); String error = Lang.get("questGUIError");
@ -663,7 +662,7 @@ public class QuestFactory implements ConversationAbandonedListener {
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.DARK_GREEN + Lang.get("questRegionTitle") + "\n"; String text = ChatColor.DARK_GREEN + Lang.get("questRegionTitle") + "\n";
boolean any = false; boolean any = false;
for (World world : quests.getServer().getWorlds()) { for (World world : plugin.getServer().getWorlds()) {
RegionManager rm = Quests.worldGuard.getRegionManager(world); RegionManager rm = Quests.worldGuard.getRegionManager(world);
for (String region : rm.getRegions().keySet()) { for (String region : rm.getRegions().keySet()) {
any = true; any = true;
@ -685,7 +684,7 @@ public class QuestFactory implements ConversationAbandonedListener {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String found = null; String found = null;
boolean done = false; boolean done = false;
for (World world : quests.getServer().getWorlds()) { for (World world : plugin.getServer().getWorlds()) {
RegionManager rm = Quests.worldGuard.getRegionManager(world); RegionManager rm = Quests.worldGuard.getRegionManager(world);
for (String region : rm.getRegions().keySet()) { for (String region : rm.getRegions().keySet()) {
if (region.equalsIgnoreCase(input)) { if (region.equalsIgnoreCase(input)) {
@ -774,7 +773,7 @@ public class QuestFactory implements ConversationAbandonedListener {
} }
FileConfiguration data = new YamlConfiguration(); FileConfiguration data = new YamlConfiguration();
try { try {
data.load(new File(quests.getDataFolder(), "quests.yml")); data.load(new File(plugin.getDataFolder(), "quests.yml"));
ConfigurationSection questSection = data.getConfigurationSection("quests"); ConfigurationSection questSection = data.getConfigurationSection("quests");
int customNum = 1; int customNum = 1;
while (true) { while (true) {
@ -786,13 +785,13 @@ public class QuestFactory implements ConversationAbandonedListener {
} }
ConfigurationSection newSection = questSection.createSection("custom" + customNum); ConfigurationSection newSection = questSection.createSection("custom" + customNum);
saveQuest(context, newSection); saveQuest(context, newSection);
data.save(new File(quests.getDataFolder(), "quests.yml")); data.save(new File(plugin.getDataFolder(), "quests.yml"));
if (context.getSessionData(CK.Q_START_NPC) != null && context.getSessionData(CK.Q_GUIDISPLAY) != null) { if (context.getSessionData(CK.Q_START_NPC) != null && context.getSessionData(CK.Q_GUIDISPLAY) != null) {
int i = (Integer) context.getSessionData(CK.Q_START_NPC); int i = (Integer) context.getSessionData(CK.Q_START_NPC);
if (!quests.questNPCGUIs.contains(i)) { if (!plugin.questNPCGUIs.contains(i)) {
quests.questNPCGUIs.add(i); plugin.questNPCGUIs.add(i);
} }
quests.updateData(); plugin.updateData();
} }
context.getForWhom().sendRawMessage(ChatColor.GREEN context.getForWhom().sendRawMessage(ChatColor.GREEN
+ Lang.get("questEditorSaved").replaceAll("<command>", "/questadmin " + Lang.get("COMMAND_QUESTADMIN_RELOAD"))); + Lang.get("questEditorSaved").replaceAll("<command>", "/questadmin " + Lang.get("COMMAND_QUESTADMIN_RELOAD")));
@ -1736,7 +1735,7 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + Lang.get("questDeleteTitle") + "\n"; String text = ChatColor.GOLD + Lang.get("questDeleteTitle") + "\n";
for (Quest quest : quests.quests) { for (Quest quest : plugin.quests) {
text += ChatColor.AQUA + quest.name + ChatColor.YELLOW + ","; text += ChatColor.AQUA + quest.name + ChatColor.YELLOW + ",";
} }
text = text.substring(0, text.length() - 1) + "\n"; text = text.substring(0, text.length() - 1) + "\n";
@ -1748,9 +1747,9 @@ public class QuestFactory implements ConversationAbandonedListener {
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
LinkedList<String> used = new LinkedList<String>(); LinkedList<String> used = new LinkedList<String>();
Quest found = quests.findQuest(input); Quest found = plugin.findQuest(input);
if (found != null) { if (found != null) {
for (Quest q : quests.quests) { for (Quest q : plugin.quests) {
if (q.neededQuests.contains(q.name) || q.blockQuests.contains(q.name)) { if (q.neededQuests.contains(q.name) || q.blockQuests.contains(q.name)) {
used.add(q.name); used.add(q.name);
} }
@ -1824,7 +1823,7 @@ public class QuestFactory implements ConversationAbandonedListener {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError")); ((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
return; return;
} }
quests.reloadQuests(); plugin.reloadQuests();
context.getForWhom().sendRawMessage(ChatColor.GREEN + Lang.get("questDeleted")); context.getForWhom().sendRawMessage(ChatColor.GREEN + Lang.get("questDeleted"));
} }
} }

View File

@ -1091,7 +1091,7 @@ public class Quester {
getQuestData(quest).itemsDelivered.put(found, (amount + i.getAmount())); getQuestData(quest).itemsDelivered.put(found, (amount + i.getAmount()));
player.getInventory().setItem(player.getInventory().first(i), null); player.getInventory().setItem(player.getInventory().first(i), null);
player.updateInventory(); player.updateInventory();
String message = Quests.parseString(getCurrentStage(quest).deliverMessages.get(random.nextInt(getCurrentStage(quest).deliverMessages.size())), plugin.citizens.getNPCRegistry().getById(getCurrentStage(quest).itemDeliveryTargets.get(getCurrentStage(quest).itemsToDeliver.indexOf(found)))); String message = Quests.parseString(getCurrentStage(quest).deliverMessages.get(random.nextInt(getCurrentStage(quest).deliverMessages.size())), Quests.citizens.getNPCRegistry().getById(getCurrentStage(quest).itemDeliveryTargets.get(getCurrentStage(quest).itemsToDeliver.indexOf(found))));
player.sendMessage(message); player.sendMessage(message);
} }
} }
@ -2490,7 +2490,7 @@ public class Quester {
if (!meta.hasLore()) { if (!meta.hasLore()) {
LinkedList<String> lines = new LinkedList<String>(); LinkedList<String> lines = new LinkedList<String>();
String desc = quests.get(i).description; String desc = quests.get(i).description;
if (desc == ChatColor.stripColor(desc)) { if (desc.equals(ChatColor.stripColor(desc))) {
lines = MiscUtil.makeLines(desc, " ", 40, ChatColor.DARK_GREEN); lines = MiscUtil.makeLines(desc, " ", 40, ChatColor.DARK_GREEN);
} else { } else {
lines = MiscUtil.makeLines(desc, " ", 40, null); lines = MiscUtil.makeLines(desc, " ", 40, null);
@ -2559,7 +2559,7 @@ public class Quester {
} }
public void resetCompass() { public void resetCompass() {
if (!Quests.useCompass) if (!plugin.useCompass)
return; return;
Player player = getPlayer(); Player player = getPlayer();
if (player == null) if (player == null)
@ -2572,7 +2572,7 @@ public class Quester {
} }
public void findCompassTarget() { public void findCompassTarget() {
if (!Quests.useCompass) if (!plugin.useCompass)
return; return;
Player player = getPlayer(); Player player = getPlayer();
if (player == null) if (player == null)

View File

@ -109,6 +109,7 @@ import net.milkbowl.vault.permission.Permission;
public class Quests extends JavaPlugin implements ConversationAbandonedListener { public class Quests extends JavaPlugin implements ConversationAbandonedListener {
// Dependencies
public static Economy economy = null; public static Economy economy = null;
public static Permission permission = null; public static Permission permission = null;
public static WorldGuardPlugin worldGuard = null; public static WorldGuardPlugin worldGuard = null;
@ -116,15 +117,30 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
public static Heroes heroes = null; public static Heroes heroes = null;
public static PhatLoots phatLoots = null; public static PhatLoots phatLoots = null;
public static PlaceholderAPIPlugin placeholder = null; public static PlaceholderAPIPlugin placeholder = null;
public static boolean npcEffects = true; public static Vault vault = null;
public static boolean useCompass = true; public static CitizensPlugin citizens;
public static boolean ignoreLockedQuests = false; public static Denizen denizen = null;
public static boolean genFilesOnJoin = true; // Config settings
public static boolean askConfirmation = true; public int acceptTimeout = 20;
public static int acceptTimeout = 20; public boolean allowCommands = true;
public static int maxQuests = 0; public boolean allowCommandsForNpcQuests = false;
public static String effect = "note"; public boolean allowQuitting = true;
public static String redoEffect = "angry_villager"; public boolean askConfirmation = true;
public boolean convertData = false;
public boolean genFilesOnJoin = true;
public boolean ignoreLockedQuests = false;
public int killDelay = 0;
public int maxQuests = 0;
public boolean npcEffects = true;
public String effect = "note";
public String redoEffect = "angry_villager";
public boolean showQuestReqs = true;
public boolean showQuestTitles = true;
public boolean translateSubCommands = false;
public boolean useCompass = true;
// Interfaces
public HashMap<String, Integer> commands = new HashMap<String, Integer>();
public HashMap<String, Integer> adminCommands = new HashMap<String, Integer>();
public final Map<UUID, Quester> questers = new HashMap<UUID, Quester>(); public final Map<UUID, Quester> questers = new HashMap<UUID, Quester>();
public final List<String> questerBlacklist = new LinkedList<String>(); public final List<String> questerBlacklist = new LinkedList<String>();
public final List<CustomRequirement> customRequirements = new LinkedList<CustomRequirement>(); public final List<CustomRequirement> customRequirements = new LinkedList<CustomRequirement>();
@ -134,30 +150,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
public final LinkedList<Event> events = new LinkedList<Event>(); public final LinkedList<Event> events = new LinkedList<Event>();
public final LinkedList<NPC> questNPCs = new LinkedList<NPC>(); public final LinkedList<NPC> questNPCs = new LinkedList<NPC>();
public final LinkedList<Integer> questNPCGUIs = new LinkedList<Integer>(); public final LinkedList<Integer> questNPCGUIs = new LinkedList<Integer>();
// Classes
public ConversationFactory conversationFactory; public ConversationFactory conversationFactory;
public ConversationFactory NPCConversationFactory; public ConversationFactory NPCConversationFactory;
public QuestFactory questFactory; public QuestFactory questFactory;
public EventFactory eventFactory; public EventFactory eventFactory;
public Vault vault = null;
public CitizensPlugin citizens;
public PlayerListener pListener; public PlayerListener pListener;
public NpcListener npcListener; public NpcListener npcListener;
public NpcEffectThread effListener; public NpcEffectThread effListener;
public Denizen denizen = null;
public QuestTaskTrigger trigger; public QuestTaskTrigger trigger;
public boolean allowCommands = true;
public boolean allowCommandsForNpcQuests = false;
public boolean showQuestReqs = true;
public boolean showQuestTitles = true;
public boolean allowQuitting = true;
public boolean convertData = false;
public boolean load = false;
public int killDelay = 0;
public int totalQuestPoints = 0;
public Lang lang = new Lang(this); public Lang lang = new Lang(this);
public HashMap<String, Integer> commands = new HashMap<String, Integer>();
public HashMap<String, Integer> adminCommands = new HashMap<String, Integer>();
private static Quests instance = null;
@SuppressWarnings("serial") @SuppressWarnings("serial")
class StageFailedException extends Exception { class StageFailedException extends Exception {
@ -171,7 +173,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
pListener = new PlayerListener(this); pListener = new PlayerListener(this);
effListener = new NpcEffectThread(this); effListener = new NpcEffectThread(this);
npcListener = new NpcListener(this); npcListener = new NpcListener(this);
instance = this;
this.conversationFactory = new ConversationFactory(this).withModality(false).withPrefix(new QuestsPrefix()).withFirstPrompt(new QuestPrompt()).withTimeout(acceptTimeout).thatExcludesNonPlayersWithMessage("Console may not perform this conversation!").addConversationAbandonedListener(this); this.conversationFactory = new ConversationFactory(this).withModality(false).withPrefix(new QuestsPrefix()).withFirstPrompt(new QuestPrompt()).withTimeout(acceptTimeout).thatExcludesNonPlayersWithMessage("Console may not perform this conversation!").addConversationAbandonedListener(this);
this.NPCConversationFactory = new ConversationFactory(this).withModality(false).withFirstPrompt(new QuestAcceptPrompt(this)).withTimeout(acceptTimeout).withLocalEcho(false).addConversationAbandonedListener(this); this.NPCConversationFactory = new ConversationFactory(this).withModality(false).withFirstPrompt(new QuestAcceptPrompt(this)).withTimeout(acceptTimeout).withLocalEcho(false).addConversationAbandonedListener(this);
questFactory = new QuestFactory(this); questFactory = new QuestFactory(this);
@ -207,12 +208,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
delayLoadQuestInfo(); delayLoadQuestInfo();
} }
/**
* Transfer language files from jar to disk
*/
private void setupLang() throws IOException, URISyntaxException { private void setupLang() throws IOException, URISyntaxException {
final String path = "lang"; final String path = "lang";
final File jarFile = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath()); final File jarFile = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath());
if(jarFile.isFile()) { if(jarFile.isFile()) {
final JarFile jar = new JarFile(jarFile); final JarFile jar = new JarFile(jarFile);
final Enumeration<JarEntry> entries = jar.entries(); //ALL entries in jar final Enumeration<JarEntry> entries = jar.entries();
Set<String> results = new HashSet<String>(); Set<String> results = new HashSet<String>();
while(entries.hasMoreElements()) { while(entries.hasMoreElements()) {
final String name = entries.nextElement().getName(); final String name = entries.nextElement().getName();
@ -305,6 +309,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
public void loadCommands() { public void loadCommands() {
// [] - required // [] - required
// {} - optional // {} - optional
if (translateSubCommands) {
commands.put(Lang.get("COMMAND_LIST"), 1); // list {page} commands.put(Lang.get("COMMAND_LIST"), 1); // list {page}
commands.put(Lang.get("COMMAND_TAKE"), 2); // take [quest] commands.put(Lang.get("COMMAND_TAKE"), 2); // take [quest]
commands.put(Lang.get("COMMAND_QUIT"), 2); // quit [quest] commands.put(Lang.get("COMMAND_QUIT"), 2); // quit [quest]
@ -326,9 +331,36 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE"), 3); // nextstage [player] [quest] adminCommands.put(Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE"), 3); // nextstage [player] [quest]
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_SETSTAGE"), 4); // setstage [player] [quest] [stage] adminCommands.put(Lang.get("COMMAND_QUESTADMIN_SETSTAGE"), 4); // setstage [player] [quest] [stage]
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_PURGE"), 2); // purge [player] adminCommands.put(Lang.get("COMMAND_QUESTADMIN_PURGE"), 2); // purge [player]
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_RESET"), 2); // purge [player] adminCommands.put(Lang.get("COMMAND_QUESTADMIN_RESET"), 2); // reset [player]
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI"), 2); // togglegui [npc id] adminCommands.put(Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI"), 2); // togglegui [npc id]
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_RELOAD"), 1); // reload adminCommands.put(Lang.get("COMMAND_QUESTADMIN_RELOAD"), 1); // reload
} else {
commands.put("list", 1); // list {page}
commands.put("take", 2); // take [quest]
commands.put("quit", 2); // quit [quest]
commands.put("editor", 1); // editor
commands.put("events", 1); // events
commands.put("stats", 1); // stats
commands.put("top", 2); // top [number]
commands.put("info", 1); // info
commands.put("journal", 1); // journal
adminCommands.put("stats", 2); // stats [player]
adminCommands.put("give", 3); // give [player] [quest]
adminCommands.put("quit", 3); // quit [player] [quest]
adminCommands.put("remove", 3); // remove [player] [quest]
adminCommands.put("points", 3); // points [player] [amount]
adminCommands.put("takepoints", 3); // takepoints [player] [amount]
adminCommands.put("givepoints", 3); // givepoints [player] [amount]
adminCommands.put("pointsall", 2); // pointsall [amount]
adminCommands.put("finish", 3); // finish [player] [quest]
adminCommands.put("nextstage", 3); // nextstage [player] [quest]
adminCommands.put("setstage", 4); // setstage [player] [quest] [stage]
adminCommands.put("purge", 2); // purge [player]
adminCommands.put("reset", 2); // reset [player]
adminCommands.put("togglegui", 2); // togglegui [npc id]
adminCommands.put("reload", 1); // reload
}
} }
public String checkCommand(String cmd, String[] args) { public String checkCommand(String cmd, String[] args) {
@ -432,8 +464,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
} }
public static Quests getInstance() { public Quests getInstance() {
return instance; return this;
} }
private class QuestPrompt extends StringPrompt { private class QuestPrompt extends StringPrompt {
@ -473,28 +505,29 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
public void loadConfig() { public void loadConfig() {
FileConfiguration config = getConfig(); FileConfiguration config = getConfig();
if (config.getString("language").equalsIgnoreCase("en")) { acceptTimeout = config.getInt("accept-timeout", 20);
//Legacy
Lang.iso = "en-US";
} else {
Lang.iso = config.getString("language", "en-US");
}
allowCommands = config.getBoolean("allow-command-questing", true); allowCommands = config.getBoolean("allow-command-questing", true);
allowCommandsForNpcQuests = config.getBoolean("allow-command-quests-with-npcs", false); allowCommandsForNpcQuests = config.getBoolean("allow-command-quests-with-npcs", false);
showQuestReqs = config.getBoolean("show-requirements", true);
showQuestTitles = config.getBoolean("show-titles", true);
allowQuitting = config.getBoolean("allow-quitting", true); allowQuitting = config.getBoolean("allow-quitting", true);
useCompass = config.getBoolean("use-compass", true);
genFilesOnJoin = config.getBoolean("generate-files-on-join", true);
askConfirmation = config.getBoolean("ask-confirmation", true); askConfirmation = config.getBoolean("ask-confirmation", true);
convertData = config.getBoolean("convert-data-on-startup", false);
genFilesOnJoin = config.getBoolean("generate-files-on-join", true);
ignoreLockedQuests = config.getBoolean("ignore-locked-quests", false);
killDelay = config.getInt("kill-delay", 600);
if (config.getString("language").equalsIgnoreCase("en")) {
//Legacy
lang.iso = "en-US";
} else {
lang.iso = config.getString("language", "en-US");
}
maxQuests = config.getInt("max-quests", maxQuests);
npcEffects = config.getBoolean("npc-effects.enabled", true); npcEffects = config.getBoolean("npc-effects.enabled", true);
effect = config.getString("npc-effects.new-quest", "note"); effect = config.getString("npc-effects.new-quest", "note");
redoEffect = config.getString("npc-effects.redo-quest", "angry_villager"); redoEffect = config.getString("npc-effects.redo-quest", "angry_villager");
killDelay = config.getInt("kill-delay", 600); showQuestReqs = config.getBoolean("show-requirements", true);
acceptTimeout = config.getInt("accept-timeout", 20); showQuestTitles = config.getBoolean("show-titles", true);
convertData = config.getBoolean("convert-data-on-startup", false); translateSubCommands = config.getBoolean("translate-subcommands", false);
ignoreLockedQuests = config.getBoolean("ignore-locked-quests", false); useCompass = config.getBoolean("use-compass", true);
maxQuests = config.getInt("max-quests", maxQuests);
for (String s : config.getStringList("quester-blacklist")) { for (String s : config.getStringList("quester-blacklist")) {
if (!s.equalsIgnoreCase("UUID")) { if (!s.equalsIgnoreCase("UUID")) {
questerBlacklist.add(s); questerBlacklist.add(s);
@ -526,11 +559,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
File f = new File(this.getDataFolder(), "modules"); File f = new File(this.getDataFolder(), "modules");
if (f.exists() && f.isDirectory()) { if (f.exists() && f.isDirectory()) {
File[] modules = f.listFiles(); File[] modules = f.listFiles();
if (modules != null) {
for (File module : modules) { for (File module : modules) {
if (module.isDirectory() == false && module.getName().endsWith(".jar")) { if (module.isDirectory() == false && module.getName().endsWith(".jar")) {
loadModule(module); loadModule(module);
} }
} }
}
} else { } else {
f.mkdir(); f.mkdir();
} }
@ -601,31 +636,40 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
player.sendMessage(ChatColor.GOLD + Lang.get(player, "questHelpTitle")); player.sendMessage(ChatColor.GOLD + Lang.get(player, "questHelpTitle"));
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "questDisplayHelp")); player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "questDisplayHelp"));
if (player.hasPermission("quests.list")) { if (player.hasPermission("quests.list")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_LIST_HELP")); player.sendMessage(ChatColor.YELLOW + "/quests "+ Lang.get(player, "COMMAND_LIST_HELP")
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_LIST") : "list"));
} }
if (player.hasPermission("quests.take")) { if (player.hasPermission("quests.take")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_TAKE_HELP")); player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_TAKE_HELP")
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_TAKE") : "take"));
} }
if (player.hasPermission("quests.quit")) { if (player.hasPermission("quests.quit")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_QUIT_HELP")); player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_QUIT_HELP")
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_QUIT") : "quit"));
} }
if (player.hasPermission("quests.journal")) { if (player.hasPermission("quests.journal")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_JOURNAL_HELP")); player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_JOURNAL_HELP")
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_JOURNAL") : "journal"));
} }
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.editor")) { if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.editor")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_EDITOR_HELP")); player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_EDITOR_HELP")
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_EDITOR") : "editor"));
} }
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.events.editor")) { if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.events.editor")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_EVENTS_EDITOR_HELP")); player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_EVENTS_EDITOR_HELP")
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_EVENTS") : "events"));
} }
if (player.hasPermission("quests.stats")) { if (player.hasPermission("quests.stats")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_STATS_HELP")); player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_STATS_HELP")
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_STATS") : "stats"));
} }
if (player.hasPermission("quests.top")) { if (player.hasPermission("quests.top")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_TOP_HELP")); player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_TOP_HELP")
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_TOP") : "top"));
} }
// player.sendMessage(GOLD + "/quests party - Quest Party commands"); // player.sendMessage(GOLD + "/quests party - Quest Party commands");
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_INFO_HELP")); player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_INFO_HELP")
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_INFO") : "info"));
player.sendMessage(" "); player.sendMessage(" ");
player.sendMessage(ChatColor.YELLOW + "/quest " + Lang.get(player, "COMMAND_QUEST_HELP")); player.sendMessage(ChatColor.YELLOW + "/quest " + Lang.get(player, "COMMAND_QUEST_HELP"));
if (player.hasPermission("quests.questinfo")) { if (player.hasPermission("quests.questinfo")) {
@ -675,36 +719,36 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
adminHelp(cs); adminHelp(cs);
return true; return true;
} }
if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_RELOAD"))) { if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats")) {
adminReload(cs);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_POINTSALL"))) {
adminPointsAll(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_GIVE"))) {
adminGive(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_POINTS"))) {
adminPoints(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS"))) {
adminTakePoints(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS"))) {
adminGivePoints(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI"))) {
adminToggieGUI(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_QUIT"))) {
adminQuit(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE"))) {
adminNextStage(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_SETSTAGE"))) {
adminSetStage(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_FINISH"))) {
adminFinish(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_PURGE"))) {
adminPurge(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_RESET"))) {
adminReset(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_STATS"))) {
adminStats(cs, args); adminStats(cs, args);
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_REMOVE"))) { } else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE") : "give")) {
adminGive(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT") : "quit")) {
adminQuit(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points")) {
adminPoints(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints")) {
adminTakePoints(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints")) {
adminGivePoints(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall")) {
adminPointsAll(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish")) {
adminFinish(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage")) {
adminNextStage(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage")) {
adminSetStage(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_PURGE") : "purge")) {
adminPurge(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset")) {
adminReset(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove")) {
adminRemove(cs, args); adminRemove(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI") : "togglegui")) {
adminToggieGUI(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RELOAD") : "reload")) {
adminReload(cs);
} else { } else {
cs.sendMessage(ChatColor.YELLOW + Lang.get("questsUnknownAdminCommand")); cs.sendMessage(ChatColor.YELLOW + Lang.get("questsUnknownAdminCommand"));
} }
@ -944,12 +988,14 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
@Override @Override
public void run() { public void run() {
File questerFolder = new File(Quests.this.getDataFolder(), "data"); File questerFolder = new File(getDataFolder(), "data");
if (questerFolder.exists() && questerFolder.isDirectory()) { if (questerFolder.exists() && questerFolder.isDirectory()) {
FileConfiguration data = new YamlConfiguration(); FileConfiguration data = new YamlConfiguration();
File[] files = questerFolder.listFiles();
int failCount = 0; int failCount = 0;
boolean suppressed = false; boolean suppressed = false;
for (File f : questerFolder.listFiles()) { if (files != null) {
for (File f : files) {
try { try {
data.load(f); data.load(f);
data.set("quest-points", amount); data.set("quest-points", amount);
@ -980,6 +1026,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
} }
} }
}
cs.sendMessage(ChatColor.GREEN + Lang.get("done")); cs.sendMessage(ChatColor.GREEN + Lang.get("done"));
String msg = Lang.get("allQuestPointsSet"); String msg = Lang.get("allQuestPointsSet");
msg = msg.replaceAll("<number>", ChatColor.AQUA + "" + amount + ChatColor.GOLD); msg = msg.replaceAll("<number>", ChatColor.AQUA + "" + amount + ChatColor.GOLD);
@ -1378,6 +1425,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
File folder = new File(this.getDataFolder(), "data"); File folder = new File(this.getDataFolder(), "data");
File[] playerFiles = folder.listFiles(); File[] playerFiles = folder.listFiles();
Map<String, Integer> questPoints = new HashMap<String, Integer>(); Map<String, Integer> questPoints = new HashMap<String, Integer>();
if (playerFiles != null) {
for (File f : playerFiles) { for (File f : playerFiles) {
FileConfiguration data = new YamlConfiguration(); FileConfiguration data = new YamlConfiguration();
try { try {
@ -1390,6 +1438,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
String name = f.getName().substring(0, (f.getName().indexOf("."))); String name = f.getName().substring(0, (f.getName().indexOf(".")));
questPoints.put(name, data.getInt("quest-points")); questPoints.put(name, data.getInt("quest-points"));
} }
}
LinkedHashMap<String, Integer> sortedMap = (LinkedHashMap<String, Integer>) Quests.sort(questPoints); LinkedHashMap<String, Integer> sortedMap = (LinkedHashMap<String, Integer>) Quests.sort(questPoints);
int numPrinted = 0; int numPrinted = 0;
String msg = Lang.get("topQuestersTitle"); String msg = Lang.get("topQuestersTitle");
@ -1884,66 +1933,96 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
cs.sendMessage(""); cs.sendMessage("");
cs.sendMessage(ChatColor.DARK_RED + "/questadmin" + ChatColor.RED + " " + Lang.get("COMMAND_QUESTADMIN_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin" + ChatColor.RED + " " + Lang.get("COMMAND_QUESTADMIN_HELP"));
if (cs.hasPermission("quests.admin.*")) { if (cs.hasPermission("quests.admin.*")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_STATS_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_STATS_HELP")
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVE_HELP")); .replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_QUIT_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVE_HELP")
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTS_HELP")); .replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE") : "give"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_QUIT_HELP")
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS_HELP")); .replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT") : "quit"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTSALL_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTS_HELP")
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_FINISH_HELP")); .replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS_HELP")
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP")); .replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_PURGE_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS_HELP")
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RESET_HELP")); .replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_REMOVE_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTSALL_HELP")
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI_HELP")); .replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RELOAD_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_FINISH_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_PURGE_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_PURGE") : "purge"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RESET_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_REMOVE_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI") : "togglegui"));
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RELOAD_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RELOAD") : "reload"));
} else { } else {
if (cs.hasPermission("quests.admin.stats")) { if (cs.hasPermission("quests.admin.stats")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_STATS_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_STATS_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats"));
} }
if (cs.hasPermission("quests.admin.give")) { if (cs.hasPermission("quests.admin.give")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVE_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVE_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE") : "give"));
} }
if (cs.hasPermission("quests.admin.quit")) { if (cs.hasPermission("quests.admin.quit")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_QUIT_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_QUIT_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT") : "quit"));
} }
if (cs.hasPermission("quests.admin.points")) { if (cs.hasPermission("quests.admin.points")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTS_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTS_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points"));
} }
if (cs.hasPermission("quests.admin.takepoints")) { if (cs.hasPermission("quests.admin.takepoints")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints"));
} }
if (cs.hasPermission("quests.admin.givepoints")) { if (cs.hasPermission("quests.admin.givepoints")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints"));
} }
if (cs.hasPermission("quests.admin.pointsall")) { if (cs.hasPermission("quests.admin.pointsall")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTSALL_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTSALL_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall"));
} }
if (cs.hasPermission("quests.admin.finish")) { if (cs.hasPermission("quests.admin.finish")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_FINISH_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_FINISH_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish"));
} }
if (cs.hasPermission("quests.admin.nextstage")) { if (cs.hasPermission("quests.admin.nextstage")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage"));
} }
if (cs.hasPermission("quests.admin.setstage")) { if (cs.hasPermission("quests.admin.setstage")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage"));
} }
if (cs.hasPermission("quests.admin.purge")) { if (cs.hasPermission("quests.admin.purge")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_PURGE_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_PURGE_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_PURGE") : "purge"));
} }
if (cs.hasPermission("quests.admin.reset")) { if (cs.hasPermission("quests.admin.reset")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RESET_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RESET_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset"));
} }
if (cs.hasPermission("quests.admin.remove")) { if (cs.hasPermission("quests.admin.remove")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_REMOVE_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_REMOVE_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove"));
} }
if (citizens != null && cs.hasPermission("quests.admin.togglegui")) { if (cs.hasPermission("quests.admin.togglegui")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI") : "togglegui"));
} }
if (cs.hasPermission("quests.admin.reload")) { if (cs.hasPermission("quests.admin.reload")) {
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RELOAD_HELP")); cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RELOAD_HELP")
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RELOAD") : "reload"));
} }
} }
} }
@ -2067,7 +2146,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
public void loadQuests() { public void loadQuests() {
boolean failedToLoad; boolean failedToLoad;
totalQuestPoints = 0;
needsSaving = false; needsSaving = false;
FileConfiguration config = null; FileConfiguration config = null;
File file = new File(this.getDataFolder(), "quests.yml"); File file = new File(this.getDataFolder(), "quests.yml");
@ -2125,7 +2203,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
quest.guiDisplay = stack; quest.guiDisplay = stack;
} }
} catch (Exception e) { } catch (Exception e) {
instance.getLogger().warning(item + " in items: GUI Display in Quest " + quest.name + "is not properly formatted!"); this.getLogger().warning(item + " in items: GUI Display in Quest " + quest.name + "is not properly formatted!");
} }
} }
if (config.contains("quests." + questName + ".redo-delay")) { if (config.contains("quests." + questName + ".redo-delay")) {
@ -2232,7 +2310,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (config.contains("quests." + questName + ".rewards.quest-points")) { if (config.contains("quests." + questName + ".rewards.quest-points")) {
if (config.getInt("quests." + questName + ".rewards.quest-points", -999) != -999) { if (config.getInt("quests." + questName + ".rewards.quest-points", -999) != -999) {
quest.questPoints = config.getInt("quests." + questName + ".rewards.quest-points"); quest.questPoints = config.getInt("quests." + questName + ".rewards.quest-points");
totalQuestPoints += quest.questPoints;
} else { } else {
skipQuestProcess("quest-points: Reward in Quest " + quest.name + " is not a number!"); skipQuestProcess("quest-points: Reward in Quest " + quest.name + " is not a number!");
} }
@ -4053,6 +4130,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
return dir.getPath().equals(dataFolder.getPath()) && name.endsWith(".yml"); return dir.getPath().equals(dataFolder.getPath()) && name.endsWith(".yml");
} }
}); });
if (files != null) {
numQuesters = files.length; numQuesters = files.length;
if (numQuesters > 0) { if (numQuesters > 0) {
final ArrayList<String> names = new ArrayList<String>(); final ArrayList<String> names = new ArrayList<String>();
@ -4125,6 +4204,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} else { } else {
getLogger().info("No Questers to convert!"); getLogger().info("No Questers to convert!");
} }
}
} else { } else {
getLogger().info("Data folder does not exist!"); getLogger().info("Data folder does not exist!");
} }

View File

@ -62,7 +62,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
this.questFactory = qf; this.questFactory = qf;
} }
@SuppressWarnings("unchecked") @SuppressWarnings({ "unchecked", "deprecation" })
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
try { try {
@ -149,7 +149,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyItemString(names.get(i)) + ChatColor.GRAY + " " + Lang.get("with") + " " + ChatColor.AQUA + Quester.prettyEnchantmentString(Quests.getEnchantment(enchants.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n"; text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyItemString(names.get(i)) + ChatColor.GRAY + " " + Lang.get("with") + " " + ChatColor.AQUA + Quester.prettyEnchantmentString(Quests.getEnchantment(enchants.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
} }
} }
if (questFactory.quests.citizens != null) { if (Quests.citizens != null) {
if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) { if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "9 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorDeliverItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "9 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorDeliverItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else { } else {
@ -164,7 +164,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
} else { } else {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "9 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorDeliverItems") + ChatColor.GRAY + " (" + Lang.get("questCitNotInstalled") + ")\n"; text += ChatColor.GRAY + "" + ChatColor.BOLD + "9 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorDeliverItems") + ChatColor.GRAY + " (" + Lang.get("questCitNotInstalled") + ")\n";
} }
if (questFactory.quests.citizens != null) { if (Quests.citizens != null) {
if (context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) == null) { if (context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "10 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorTalkToNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "10 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorTalkToNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else { } else {
@ -178,7 +178,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
} else { } else {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "10 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorTalkToNPCs") + ChatColor.GRAY + " (" + Lang.get("questCitNotInstalled") + ")\n"; text += ChatColor.GRAY + "" + ChatColor.BOLD + "10 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorTalkToNPCs") + ChatColor.GRAY + " (" + Lang.get("questCitNotInstalled") + ")\n";
} }
if (questFactory.quests.citizens != null) { if (Quests.citizens != null) {
if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) { if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "11 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorKillNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "11 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorKillNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else { } else {
@ -264,7 +264,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
} else { } else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "18 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorDelayMessage") + ChatColor.GRAY + " (" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_DELAY_MESSAGE) + "\"" + ChatColor.GRAY + ")\n"; text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "18 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorDelayMessage") + ChatColor.GRAY + " (" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_DELAY_MESSAGE) + "\"" + ChatColor.GRAY + ")\n";
} }
if (questFactory.quests.denizen == null) { if (Quests.denizen == null) {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "19 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorDenizenScript") + ChatColor.GRAY + " (" + Lang.get("questDenNotInstalled") + ")\n"; text += ChatColor.GRAY + "" + ChatColor.BOLD + "19 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorDenizenScript") + ChatColor.GRAY + " (" + Lang.get("questDenNotInstalled") + ")\n";
} else { } else {
if (context.getSessionData(pref + CK.S_DENIZEN) == null) { if (context.getSessionData(pref + CK.S_DENIZEN) == null) {
@ -354,21 +354,21 @@ public class CreateStagePrompt extends FixedSetPrompt {
} else if (input.equalsIgnoreCase("8")) { } else if (input.equalsIgnoreCase("8")) {
return new EnchantmentListPrompt(); return new EnchantmentListPrompt();
} else if (input.equalsIgnoreCase("9")) { } else if (input.equalsIgnoreCase("9")) {
if (questFactory.quests.citizens != null) { if (Quests.citizens != null) {
return new DeliveryListPrompt(); return new DeliveryListPrompt();
} else { } else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
return new CreateStagePrompt(stageNum, questFactory, citizens); return new CreateStagePrompt(stageNum, questFactory, citizens);
} }
} else if (input.equalsIgnoreCase("10")) { } else if (input.equalsIgnoreCase("10")) {
if (questFactory.quests.citizens != null) { if (Quests.citizens != null) {
return new NPCIDsToTalkToPrompt(); return new NPCIDsToTalkToPrompt();
} else { } else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
return new CreateStagePrompt(stageNum, questFactory, citizens); return new CreateStagePrompt(stageNum, questFactory, citizens);
} }
} else if (input.equalsIgnoreCase("11")) { } else if (input.equalsIgnoreCase("11")) {
if (questFactory.quests.citizens != null) { if (Quests.citizens != null) {
return new NPCKillListPrompt(); return new NPCKillListPrompt();
} else { } else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
@ -394,7 +394,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new DelayMessagePrompt(); return new DelayMessagePrompt();
} }
} else if (input.equalsIgnoreCase("19")) { } else if (input.equalsIgnoreCase("19")) {
if (questFactory.quests.denizen == null) { if (Quests.denizen == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDenizen")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDenizen"));
return new CreateStagePrompt(stageNum, questFactory, citizens); return new CreateStagePrompt(stageNum, questFactory, citizens);
} else { } else {
@ -610,6 +610,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
super("1", "2", "3", "4", "5"); super("1", "2", "3", "4", "5");
} }
@SuppressWarnings("deprecation")
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorBreakBlocks") + " -\n"; String text = ChatColor.GOLD + "- " + Lang.get("stageEditorBreakBlocks") + " -\n";
@ -827,6 +828,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
super("1", "2", "3", "4", "5"); super("1", "2", "3", "4", "5");
} }
@SuppressWarnings("deprecation")
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorDamageBlocks") + " -\n"; String text = ChatColor.GOLD + "- " + Lang.get("stageEditorDamageBlocks") + " -\n";
@ -1044,6 +1046,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
super("1", "2", "3", "4", "5"); super("1", "2", "3", "4", "5");
} }
@SuppressWarnings("deprecation")
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorPlaceBlocks") + " -\n"; String text = ChatColor.GOLD + "- " + Lang.get("stageEditorPlaceBlocks") + " -\n";
@ -1261,6 +1264,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
super("1", "2", "3", "4", "5"); super("1", "2", "3", "4", "5");
} }
@SuppressWarnings("deprecation")
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorUseBlocks") + " -\n"; String text = ChatColor.GOLD + "- " + Lang.get("stageEditorUseBlocks") + " -\n";
@ -1478,6 +1482,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
super("1", "2", "3", "4", "5"); super("1", "2", "3", "4", "5");
} }
@SuppressWarnings("deprecation")
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorCutBlocks") + " -\n"; String text = ChatColor.GOLD + "- " + Lang.get("stageEditorCutBlocks") + " -\n";
@ -1741,6 +1746,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
super("1", "2", "3", "4", "5"); super("1", "2", "3", "4", "5");
} }
@SuppressWarnings("deprecation")
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorEnchantItems") + " -\n"; String text = ChatColor.GOLD + "- " + Lang.get("stageEditorEnchantItems") + " -\n";
@ -3253,10 +3259,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorStartEvent") + " -\n"; String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorStartEvent") + " -\n";
if (questFactory.quests.events.isEmpty()) { if (questFactory.plugin.events.isEmpty()) {
text += ChatColor.RED + "- None"; text += ChatColor.RED + "- None";
} else { } else {
for (Event e : questFactory.quests.events) { for (Event e : questFactory.plugin.events) {
text += ChatColor.GREEN + "- " + e.getName() + "\n"; text += ChatColor.GREEN + "- " + e.getName() + "\n";
} }
} }
@ -3268,7 +3274,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
Player player = (Player) context.getForWhom(); Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Event found = null; Event found = null;
for (Event e : questFactory.quests.events) { for (Event e : questFactory.plugin.events) {
if (e.getName().equalsIgnoreCase(input)) { if (e.getName().equalsIgnoreCase(input)) {
found = e; found = e;
break; break;
@ -3298,10 +3304,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorFinishEvent") + " -\n"; String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorFinishEvent") + " -\n";
if (questFactory.quests.events.isEmpty()) { if (questFactory.plugin.events.isEmpty()) {
text += ChatColor.RED + "- " + Lang.get("none"); text += ChatColor.RED + "- " + Lang.get("none");
} else { } else {
for (Event e : questFactory.quests.events) { for (Event e : questFactory.plugin.events) {
text += ChatColor.GREEN + "- " + e.getName() + "\n"; text += ChatColor.GREEN + "- " + e.getName() + "\n";
} }
} }
@ -3313,7 +3319,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
Player player = (Player) context.getForWhom(); Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Event found = null; Event found = null;
for (Event e : questFactory.quests.events) { for (Event e : questFactory.plugin.events) {
if (e.getName().equalsIgnoreCase(input)) { if (e.getName().equalsIgnoreCase(input)) {
found = e; found = e;
break; break;
@ -3343,10 +3349,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorDeathEvent") + " -\n"; String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorDeathEvent") + " -\n";
if (questFactory.quests.events.isEmpty()) { if (questFactory.plugin.events.isEmpty()) {
text += ChatColor.RED + "- None"; text += ChatColor.RED + "- None";
} else { } else {
for (Event e : questFactory.quests.events) { for (Event e : questFactory.plugin.events) {
text += ChatColor.GREEN + "- " + e.getName() + "\n"; text += ChatColor.GREEN + "- " + e.getName() + "\n";
} }
} }
@ -3358,7 +3364,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
Player player = (Player) context.getForWhom(); Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Event found = null; Event found = null;
for (Event e : questFactory.quests.events) { for (Event e : questFactory.plugin.events) {
if (e.getName().equalsIgnoreCase(input)) { if (e.getName().equalsIgnoreCase(input)) {
found = e; found = e;
break; break;
@ -3388,10 +3394,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorDisconnectEvent") + " -\n"; String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorDisconnectEvent") + " -\n";
if (questFactory.quests.events.isEmpty()) { if (questFactory.plugin.events.isEmpty()) {
text += ChatColor.RED + "- " + Lang.get("none"); text += ChatColor.RED + "- " + Lang.get("none");
} else { } else {
for (Event e : questFactory.quests.events) { for (Event e : questFactory.plugin.events) {
text += ChatColor.GREEN + "- " + e.getName() + "\n"; text += ChatColor.GREEN + "- " + e.getName() + "\n";
} }
} }
@ -3403,7 +3409,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
Player player = (Player) context.getForWhom(); Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Event found = null; Event found = null;
for (Event e : questFactory.quests.events) { for (Event e : questFactory.plugin.events) {
if (e.getName().equalsIgnoreCase(input)) { if (e.getName().equalsIgnoreCase(input)) {
found = e; found = e;
break; break;
@ -3433,10 +3439,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorChatEvents") + " -\n"; String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorChatEvents") + " -\n";
if (questFactory.quests.events.isEmpty()) { if (questFactory.plugin.events.isEmpty()) {
text += ChatColor.RED + "- " + Lang.get("none"); text += ChatColor.RED + "- " + Lang.get("none");
} else { } else {
for (Event e : questFactory.quests.events) { for (Event e : questFactory.plugin.events) {
text += ChatColor.GREEN + "- " + e.getName() + "\n"; text += ChatColor.GREEN + "- " + e.getName() + "\n";
} }
} }
@ -3448,7 +3454,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
Player player = (Player) context.getForWhom(); Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Event found = null; Event found = null;
for (Event e : questFactory.quests.events) { for (Event e : questFactory.plugin.events) {
if (e.getName().equalsIgnoreCase(input)) { if (e.getName().equalsIgnoreCase(input)) {
found = e; found = e;
break; break;
@ -3520,10 +3526,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorCommandEvents") + " -\n"; String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorCommandEvents") + " -\n";
if (questFactory.quests.events.isEmpty()) { if (questFactory.plugin.events.isEmpty()) {
text += ChatColor.RED + "- " + Lang.get("none"); text += ChatColor.RED + "- " + Lang.get("none");
} else { } else {
for (Event e : questFactory.quests.events) { for (Event e : questFactory.plugin.events) {
text += ChatColor.GREEN + "- " + e.getName() + "\n"; text += ChatColor.GREEN + "- " + e.getName() + "\n";
} }
} }
@ -3535,7 +3541,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
Player player = (Player) context.getForWhom(); Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Event found = null; Event found = null;
for (Event e : questFactory.quests.events) { for (Event e : questFactory.plugin.events) {
if (e.getName().equalsIgnoreCase(input)) { if (e.getName().equalsIgnoreCase(input)) {
found = e; found = e;
break; break;
@ -3769,10 +3775,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
String text = ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorCustom") + " -\n"; String text = ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorCustom") + " -\n";
if (questFactory.quests.customObjectives.isEmpty()) { if (questFactory.plugin.customObjectives.isEmpty()) {
text += ChatColor.BOLD + "" + ChatColor.DARK_PURPLE + "(" + Lang.get("stageEditorNoModules") + ") "; text += ChatColor.BOLD + "" + ChatColor.DARK_PURPLE + "(" + Lang.get("stageEditorNoModules") + ") ";
} else { } else {
for (CustomObjective co : questFactory.quests.customObjectives) { for (CustomObjective co : questFactory.plugin.customObjectives) {
text += ChatColor.DARK_PURPLE + " - " + co.getName() + "\n"; text += ChatColor.DARK_PURPLE + " - " + co.getName() + "\n";
} }
} }
@ -3784,14 +3790,14 @@ public class CreateStagePrompt extends FixedSetPrompt {
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
CustomObjective found = null; CustomObjective found = null;
for (CustomObjective co : questFactory.quests.customObjectives) { for (CustomObjective co : questFactory.plugin.customObjectives) {
if (co.getName().equalsIgnoreCase(input)) { if (co.getName().equalsIgnoreCase(input)) {
found = co; found = co;
break; break;
} }
} }
if (found == null) { if (found == null) {
for (CustomObjective co : questFactory.quests.customObjectives) { for (CustomObjective co : questFactory.plugin.customObjectives) {
if (co.getName().toLowerCase().contains(input.toLowerCase())) { if (co.getName().toLowerCase().contains(input.toLowerCase())) {
found = co; found = co;
break; break;
@ -3857,7 +3863,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
String objName = list.getLast(); String objName = list.getLast();
text += objName + " -\n"; text += objName + " -\n";
CustomObjective found = null; CustomObjective found = null;
for (CustomObjective co : questFactory.quests.customObjectives) { for (CustomObjective co : questFactory.plugin.customObjectives) {
if (co.getName().equals(objName)) { if (co.getName().equals(objName)) {
found = co; found = co;
break; break;
@ -3879,7 +3885,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
LinkedList<String> list = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES); LinkedList<String> list = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
String objName = list.getLast(); String objName = list.getLast();
CustomObjective found = null; CustomObjective found = null;
for (CustomObjective co : questFactory.quests.customObjectives) { for (CustomObjective co : questFactory.plugin.customObjectives) {
if (co.getName().equals(objName)) { if (co.getName().equals(objName)) {
found = co; found = co;
break; break;

View File

@ -37,7 +37,7 @@ import me.blackvein.quests.util.Lang;
public class ItemStackPrompt extends FixedSetPrompt { public class ItemStackPrompt extends FixedSetPrompt {
// Stores itemstack in "tempStack" context data. // Stores ItemStack in "tempStack" context data
// Stores name in "tempName" // Stores name in "tempName"
// Stores amount in "tempAmount" // Stores amount in "tempAmount"
// Stores data in "tempData" // Stores data in "tempData"
@ -426,6 +426,7 @@ public class ItemStackPrompt extends FixedSetPrompt {
} }
} }
@SuppressWarnings("deprecation")
private String getItemData(ConversationContext cc) { private String getItemData(ConversationContext cc) {
if (cc.getSessionData("tempName") != null) { if (cc.getSessionData("tempName") != null) {
String item; String item;

View File

@ -101,14 +101,14 @@ public class QuestAcceptPrompt extends StringPrompt {
} else { } else {
Player player = quester.getPlayer(); Player player = quester.getPlayer();
if (!quester.completedQuests.contains(q.name)) { if (!quester.completedQuests.contains(q.name)) {
if (quester.currentQuests.size() < Quests.maxQuests || Quests.maxQuests < 1) { if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
if (q.testRequirements(quester)) { if (q.testRequirements(quester)) {
quester.questToTake = q.name; quester.questToTake = q.name;
String s = extracted(quester); String s = extracted(quester);
for (String msg : s.split("<br>")) { for (String msg : s.split("<br>")) {
player.sendMessage(msg); player.sendMessage(msg);
} }
if (!Quests.askConfirmation) { if (!plugin.askConfirmation) {
plugin.getQuester(player.getUniqueId()).takeQuest(plugin.getQuest(plugin.getQuester(player.getUniqueId()).questToTake), false); plugin.getQuester(player.getUniqueId()).takeQuest(plugin.getQuest(plugin.getQuester(player.getUniqueId()).questToTake), false);
} else { } else {
plugin.conversationFactory.buildConversation((Conversable) player).begin(); plugin.conversationFactory.buildConversation((Conversable) player).begin();
@ -118,11 +118,11 @@ public class QuestAcceptPrompt extends StringPrompt {
} }
} else if (quester.currentQuests.containsKey(q) == false) { } else if (quester.currentQuests.containsKey(q) == false) {
String msg = Lang.get("questMaxAllowed"); String msg = Lang.get("questMaxAllowed");
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests)); msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
player.sendMessage(ChatColor.YELLOW + msg); player.sendMessage(ChatColor.YELLOW + msg);
} }
} else if (quester.completedQuests.contains(q.name)) { } else if (quester.completedQuests.contains(q.name)) {
if (quester.currentQuests.size() < Quests.maxQuests || Quests.maxQuests < 1) { if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
if (quester.getDifference(q) > 0) { if (quester.getDifference(q) > 0) {
String early = Lang.get("questTooEarly"); String early = Lang.get("questTooEarly");
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW); early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
@ -138,7 +138,7 @@ public class QuestAcceptPrompt extends StringPrompt {
for (String msg : s.split("<br>")) { for (String msg : s.split("<br>")) {
player.sendMessage(msg); player.sendMessage(msg);
} }
if (!Quests.askConfirmation) { if (!plugin.askConfirmation) {
plugin.getQuester(player.getUniqueId()).takeQuest(plugin.getQuest(plugin.getQuester(player.getUniqueId()).questToTake), false); plugin.getQuester(player.getUniqueId()).takeQuest(plugin.getQuest(plugin.getQuester(player.getUniqueId()).questToTake), false);
} else { } else {
plugin.conversationFactory.buildConversation((Conversable) player).begin(); plugin.conversationFactory.buildConversation((Conversable) player).begin();
@ -146,7 +146,7 @@ public class QuestAcceptPrompt extends StringPrompt {
} }
} else if (quester.currentQuests.containsKey(q) == false) { } else if (quester.currentQuests.containsKey(q) == false) {
String msg = Lang.get("questMaxAllowed"); String msg = Lang.get("questMaxAllowed");
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests)); msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
player.sendMessage(ChatColor.YELLOW + msg); player.sendMessage(ChatColor.YELLOW + msg);
} }
} }

View File

@ -18,6 +18,7 @@ import org.bukkit.conversations.Prompt;
import org.bukkit.conversations.StringPrompt; import org.bukkit.conversations.StringPrompt;
import me.blackvein.quests.QuestFactory; import me.blackvein.quests.QuestFactory;
import me.blackvein.quests.Quests;
import me.blackvein.quests.util.CK; import me.blackvein.quests.util.CK;
import me.blackvein.quests.util.Lang; import me.blackvein.quests.util.Lang;
@ -55,9 +56,9 @@ public class StagesPrompt extends StringPrompt {
if (i < 0) { if (i < 0) {
return new StagesPrompt(questFactory); return new StagesPrompt(questFactory);
} else if (i < (stages + 1) && i > 0) { } else if (i < (stages + 1) && i > 0) {
return new CreateStagePrompt((i), questFactory, questFactory.quests.citizens); return new CreateStagePrompt((i), questFactory, Quests.citizens);
} else if (i == (stages + 1)) { } else if (i == (stages + 1)) {
return new CreateStagePrompt((stages + 1), questFactory, questFactory.quests.citizens); return new CreateStagePrompt((stages + 1), questFactory, Quests.citizens);
} else if (i == (stages + 2)) { } else if (i == (stages + 2)) {
return questFactory.returnToMenu(); return questFactory.returnToMenu();
} else { } else {

View File

@ -32,7 +32,7 @@ import me.clip.placeholderapi.PlaceholderAPI;
public class Lang { public class Lang {
public static String iso = "en-US"; public String iso = "en-US";
private static final LangToken tokens = new LangToken(); private static final LangToken tokens = new LangToken();
public static final LinkedHashMap<String, String> langMap = new LinkedHashMap<String, String>(); public static final LinkedHashMap<String, String> langMap = new LinkedHashMap<String, String>();
private final Quests plugin; private final Quests plugin;

View File

@ -16,6 +16,7 @@ npc-effects:
redo-quest: angry_villager redo-quest: angry_villager
show-requirements: true show-requirements: true
show-titles: true show-titles: true
translate-subcommands: false
use-compass: true use-compass: true
quester-blacklist: quester-blacklist:
- UUID - UUID

View File

@ -1,57 +1,57 @@
COMMAND_LIST: "list" COMMAND_LIST: "list"
COMMAND_LIST_HELP: "list [page] - List available Quests" COMMAND_LIST_HELP: "<command> [page] - List available Quests"
COMMAND_TAKE: "take" COMMAND_TAKE: "take"
COMMAND_TAKE_HELP: "take [quest name] - Accept a Quest" COMMAND_TAKE_HELP: "<command> [quest] - Accept a Quest"
COMMAND_TAKE_USAGE: 'Usage: /quests take [quest]' COMMAND_TAKE_USAGE: "Usage: /quests take [quest]"
COMMAND_QUIT: "quit" COMMAND_QUIT: "quit"
COMMAND_QUIT_HELP: "quit [quest] - Quit a current Quest" COMMAND_QUIT_HELP: "<command> [quest] - Quit a current Quest"
COMMAND_EDITOR: "editor"
COMMAND_EDITOR_HELP: "editor - Create/Edit Quests"
COMMAND_EVENTS_EDITOR: "events"
COMMAND_EVENTS_EDITOR_HELP: "events - Create/Edit Events"
COMMAND_STATS: "stats"
COMMAND_STATS_HELP: "stats - View your Questing stats"
COMMAND_TOP: "top"
COMMAND_TOP_HELP: "top [number] - View top Questers"
COMMAND_TOP_USAGE: 'Usage: /quests top [number]'
COMMAND_INFO: "info"
COMMAND_INFO_HELP: "info - Display plugin information"
COMMAND_JOURNAL: "journal" COMMAND_JOURNAL: "journal"
COMMAND_JOURNAL_HELP: "journal - View/Put away your Quest Journal" COMMAND_JOURNAL_HELP: "<command> - View/Put away your Quest Journal"
COMMAND_EDITOR: "editor"
COMMAND_EDITOR_HELP: "<command> - Create/Edit Quests"
COMMAND_EVENTS_EDITOR: "events"
COMMAND_EVENTS_EDITOR_HELP: "<command> - Create/Edit Events"
COMMAND_STATS: "stats"
COMMAND_STATS_HELP: "<command> - View your Questing stats"
COMMAND_TOP: "top"
COMMAND_TOP_HELP: "<command> [number] - View top Questers"
COMMAND_TOP_USAGE: "Usage: /quests top [number]"
COMMAND_INFO: "info"
COMMAND_INFO_HELP: "<command> - Display plugin information"
COMMAND_QUEST_HELP: "- Display current Quest objectives" COMMAND_QUEST_HELP: "- Display current Quest objectives"
COMMAND_QUESTINFO_HELP: "[quest name] - Display Quest information" COMMAND_QUESTINFO_HELP: "[quest] - Display Quest information"
COMMAND_QUESTADMIN_HELP: "- View Questadmin help" COMMAND_QUESTADMIN_HELP: "- View Questadmin help"
COMMAND_QUESTADMIN_STATS: "stats" COMMAND_QUESTADMIN_STATS: "stats"
COMMAND_QUESTADMIN_STATS_HELP: "stats [player] - View Questing statistics of a player" COMMAND_QUESTADMIN_STATS_HELP: "<command> [player] - View Questing statistics of a player"
COMMAND_QUESTADMIN_GIVE: "give" COMMAND_QUESTADMIN_GIVE: "give"
COMMAND_QUESTADMIN_GIVE_HELP: "give [player] [quest] - Force a player to take a Quest" COMMAND_QUESTADMIN_GIVE_HELP: "<command> [player] [quest] - Force a player to take a Quest"
COMMAND_QUESTADMIN_QUIT: "quit" COMMAND_QUESTADMIN_QUIT: "quit"
COMMAND_QUESTADMIN_QUIT_HELP: "quit [player] [quest] - Force a player to quit their Quest" COMMAND_QUESTADMIN_QUIT_HELP: "<command> [player] [quest] - Force a player to quit their Quest"
COMMAND_QUESTADMIN_POINTS: "points" COMMAND_QUESTADMIN_POINTS: "points"
COMMAND_QUESTADMIN_POINTS_HELP: "points [player] [amount] - Set a players Quest Points" COMMAND_QUESTADMIN_POINTS_HELP: "<command> [player] [amount] - Set a players Quest Points"
COMMAND_QUESTADMIN_TAKEPOINTS: "takepoints" COMMAND_QUESTADMIN_TAKEPOINTS: "takepoints"
COMMAND_QUESTADMIN_TAKEPOINTS_HELP: "takepoints [player] [amount] - Take a players Quest Points" COMMAND_QUESTADMIN_TAKEPOINTS_HELP: "<command> [player] [amount] - Take a players Quest Points"
COMMAND_QUESTADMIN_GIVEPOINTS: "givepoints" COMMAND_QUESTADMIN_GIVEPOINTS: "givepoints"
COMMAND_QUESTADMIN_GIVEPOINTS_HELP: "givepoints [player] [amount] - Give a player Quest Points" COMMAND_QUESTADMIN_GIVEPOINTS_HELP: "<command> [player] [amount] - Give a player Quest Points"
COMMAND_QUESTADMIN_POINTSALL: "pointsall" COMMAND_QUESTADMIN_POINTSALL: "pointsall"
COMMAND_QUESTADMIN_POINTSALL_HELP: "pointsall [amount] - Set ALL players' Quest Points" COMMAND_QUESTADMIN_POINTSALL_HELP: "<command> [amount] - Set ALL players' Quest Points"
COMMAND_QUESTADMIN_FINISH: "finish" COMMAND_QUESTADMIN_FINISH: "finish"
COMMAND_QUESTADMIN_FINISH_HELP: "finish [player] [quest] - Immediately force Quest completion for a player" COMMAND_QUESTADMIN_FINISH_HELP: "<command> [player] [quest] - Immediately force Quest completion for a player"
COMMAND_QUESTADMIN_NEXTSTAGE: "nextstage" COMMAND_QUESTADMIN_NEXTSTAGE: "nextstage"
COMMAND_QUESTADMIN_NEXTSTAGE_HELP: "nextstage [player] [quest] - Immediately force Stage completion for a player" COMMAND_QUESTADMIN_NEXTSTAGE_HELP: "<command> [player] [quest] - Immediately force Stage completion for a player"
COMMAND_QUESTADMIN_SETSTAGE: "setstage" COMMAND_QUESTADMIN_SETSTAGE: "setstage"
COMMAND_QUESTADMIN_SETSTAGE_HELP: "setstage [player] [quest] [stage] - Set the current Stage for a player" COMMAND_QUESTADMIN_SETSTAGE_HELP: "<command> [player] [quest] [stage] - Set the current Stage for a player"
COMMAND_QUESTADMIN_SETSTAGE_USAGE: 'Usage: /questadmin setstage [player] [quest] [stage]' COMMAND_QUESTADMIN_SETSTAGE_USAGE: 'Usage: /questadmin setstage [player] [quest] [stage]'
COMMAND_QUESTADMIN_PURGE: "purge" COMMAND_QUESTADMIN_PURGE: "purge"
COMMAND_QUESTADMIN_PURGE_HELP: "purge [player] - Clear all Quests data of a player AND BLACKLISTS THEM" COMMAND_QUESTADMIN_PURGE_HELP: "<command> [player] - Clear all Quests data of a player AND BLACKLISTS THEM"
COMMAND_QUESTADMIN_RESET: "reset" COMMAND_QUESTADMIN_RESET: "reset"
COMMAND_QUESTADMIN_RESET_HELP: "reset [player] - Clear all Quests data of a player" COMMAND_QUESTADMIN_RESET_HELP: "<command> [player] - Clear all Quests data of a player"
COMMAND_QUESTADMIN_REMOVE: "remove" COMMAND_QUESTADMIN_REMOVE: "remove"
COMMAND_QUESTADMIN_REMOVE_HELP: "remove [player] [quest] - Remove a completed Quest from a player" COMMAND_QUESTADMIN_REMOVE_HELP: "<command> [player] [quest] - Remove a completed Quest from a player"
COMMAND_QUESTADMIN_TOGGLEGUI: "togglegui" COMMAND_QUESTADMIN_TOGGLEGUI: "togglegui"
COMMAND_QUESTADMIN_TOGGLEGUI_HELP: "togglegui [npc id] - Toggle GUI Quest Display on an NPC" COMMAND_QUESTADMIN_TOGGLEGUI_HELP: "<command> [npc id] - Toggle GUI Quest Display on an NPC"
COMMAND_QUESTADMIN_RELOAD: "reload" COMMAND_QUESTADMIN_RELOAD: "reload"
COMMAND_QUESTADMIN_RELOAD_HELP: "reload - Reload all Quests" COMMAND_QUESTADMIN_RELOAD_HELP: "<command> - Reload all Quests"
questEditorHeader: "Create Quest" questEditorHeader: "Create Quest"
questEditorCreate: "Create new Quest" questEditorCreate: "Create new Quest"
questEditorEdit: "Edit a Quest" questEditorEdit: "Edit a Quest"