mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-22 17:17:38 +01:00
Add subcommand language toggle. Possibly BREAKING cleanup! Bump version
This commit is contained in:
parent
189ae08e92
commit
36dbf1b76e
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests</artifactId>
|
||||
<version>3.2.6</version>
|
||||
<version>3.2.7</version>
|
||||
<name>quests</name>
|
||||
<url>https://github.com/FlyingPikachu/Quests/</url>
|
||||
<packaging>jar</packaging>
|
||||
|
@ -20,6 +20,7 @@ import org.bukkit.event.Listener;
|
||||
|
||||
public abstract class CustomObjective implements Listener {
|
||||
|
||||
private Quests plugin = Quests.getPlugin(Quests.class);
|
||||
private String name = null;
|
||||
private String author = null;
|
||||
public final Map<String, Object> datamap = new HashMap<String, Object>();
|
||||
@ -94,8 +95,8 @@ public abstract class CustomObjective implements Listener {
|
||||
this.enableCount = enableCount;
|
||||
}
|
||||
|
||||
public static Map<String, Object> getDatamap(Player player, CustomObjective obj, Quest quest) {
|
||||
Quester quester = Quests.getInstance().getQuester(player.getUniqueId());
|
||||
public Map<String, Object> getDatamap(Player player, CustomObjective obj, Quest quest) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester != null) {
|
||||
Stage currentStage = quester.getCurrentStage(quest);
|
||||
if (currentStage == null)
|
||||
@ -116,8 +117,8 @@ public abstract class CustomObjective implements Listener {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void incrementObjective(Player player, CustomObjective obj, int count, Quest quest) {
|
||||
Quester quester = Quests.getInstance().getQuester(player.getUniqueId());
|
||||
public void incrementObjective(Player player, CustomObjective obj, int count, Quest quest) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester != null) {
|
||||
// Check if the player has Quest with objective
|
||||
boolean hasQuest = false;
|
||||
@ -130,9 +131,9 @@ public abstract class CustomObjective implements Listener {
|
||||
if (hasQuest && quester.hasCustomObjective(quest, obj.getName())) {
|
||||
if (quester.getQuestData(quest).customObjectiveCounts.containsKey(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 {
|
||||
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;
|
||||
for (int i = 0; i < quester.getCurrentStage(quest).customObjectives.size(); i++) {
|
||||
|
@ -46,13 +46,13 @@ public class NpcEffectThread implements Runnable {
|
||||
List<Entity> nearby = player.getNearbyEntities(32.0, 32.0, 32.0);
|
||||
if (nearby.isEmpty() == false) {
|
||||
for (Entity e : nearby) {
|
||||
if (plugin.citizens != null) {
|
||||
if (plugin.citizens.getNPCRegistry().isNPC(e)) {
|
||||
NPC npc = plugin.citizens.getNPCRegistry().getNPC(e);
|
||||
if (Quests.citizens != null) {
|
||||
if (Quests.citizens.getNPCRegistry().isNPC(e)) {
|
||||
NPC npc = Quests.citizens.getNPCRegistry().getNPC(e);
|
||||
if (plugin.hasQuest(npc, quester)) {
|
||||
showEffect(player, npc, Quests.effect);
|
||||
showEffect(player, npc, plugin.effect);
|
||||
} 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
|
||||
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")) {
|
||||
showEffect_R3(player, npc, effectType);
|
||||
} 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.
|
||||
Location eyeLoc = npc.getEntity().getLocation();
|
||||
eyeLoc.setY(eyeLoc.getY() + 1.5);
|
||||
@ -173,12 +173,12 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Eff_1_12_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
|
||||
} 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.
|
||||
Location eyeLoc = npc.getEntity().getLocation();
|
||||
eyeLoc.setY(eyeLoc.getY() + 1.5);
|
||||
@ -265,12 +265,12 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Eff_1_11_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
|
||||
} 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.
|
||||
Location eyeLoc = npc.getEntity().getLocation();
|
||||
eyeLoc.setY(eyeLoc.getY() + 1.5);
|
||||
@ -357,12 +357,12 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Eff_1_10_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
|
||||
} 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.
|
||||
Location eyeLoc = npc.getEntity().getLocation();
|
||||
eyeLoc.setY(eyeLoc.getY() + 1.5);
|
||||
@ -449,12 +449,12 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Eff_1_9_R2.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
|
||||
} 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.
|
||||
Location eyeLoc = npc.getEntity().getLocation();
|
||||
eyeLoc.setY(eyeLoc.getY() + 1.5);
|
||||
@ -541,12 +541,12 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Eff_1_9_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
|
||||
} 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.
|
||||
Location eyeLoc = npc.getEntity().getLocation();
|
||||
eyeLoc.setY(eyeLoc.getY() + 1.5);
|
||||
@ -633,12 +633,12 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Eff_1_8_R3.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
|
||||
} 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.
|
||||
Location eyeLoc = npc.getEntity().getLocation();
|
||||
eyeLoc.setY(eyeLoc.getY() + 1.5);
|
||||
@ -725,12 +725,12 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Eff_1_8_R2.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
|
||||
} 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.
|
||||
Location eyeLoc = npc.getEntity().getLocation();
|
||||
eyeLoc.setY(eyeLoc.getY() + 1.5);
|
||||
@ -817,12 +817,12 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Eff_1_8_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
|
||||
} 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.
|
||||
Location eyeLoc = npc.getEntity().getLocation();
|
||||
eyeLoc.setY(eyeLoc.getY() + 1.5);
|
||||
@ -909,12 +909,12 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Eff_1_7_R4.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3);
|
||||
} 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.
|
||||
Location eyeLoc = npc.getEntity().getLocation();
|
||||
eyeLoc.setY(eyeLoc.getY() + 1.5);
|
||||
@ -1002,7 +1002,7 @@ public class NpcEffectThread implements Runnable {
|
||||
try {
|
||||
Eff_1_7_R3.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3);
|
||||
} catch (Exception e) {
|
||||
Quests.getInstance().getLogger().info(effectType + " is not a valid effect name!");
|
||||
plugin.getLogger().info(effectType + " is not a valid effect name!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class NpcListener implements Listener {
|
||||
if (quester.currentQuests.containsKey(q))
|
||||
continue;
|
||||
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)) {
|
||||
npcQuests.add(q);
|
||||
}
|
||||
@ -131,7 +131,7 @@ public class NpcListener implements Listener {
|
||||
} else if (npcQuests.size() == 1) {
|
||||
Quest q = npcQuests.get(0);
|
||||
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;
|
||||
String s = extracted(quester);
|
||||
for (String msg : s.split("<br>")) {
|
||||
@ -140,10 +140,10 @@ public class NpcListener implements Listener {
|
||||
plugin.conversationFactory.buildConversation(player).begin();
|
||||
} else if (quester.currentQuests.containsKey(q) == false) {
|
||||
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);
|
||||
}
|
||||
} 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) {
|
||||
String early = Lang.get(player, "questTooEarly");
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
} else if (npcQuests.isEmpty()) {
|
||||
@ -192,7 +192,7 @@ public class NpcListener implements Listener {
|
||||
if (evt.getNPC().getEntity().getLastDamageCause().getEntity() instanceof Player) {
|
||||
Player player = (Player) evt.getNPC().getEntity().getLastDamageCause().getEntity();
|
||||
boolean okay = true;
|
||||
if (plugin.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(player)) {
|
||||
okay = false;
|
||||
}
|
||||
@ -208,8 +208,8 @@ public class NpcListener implements Listener {
|
||||
}
|
||||
} else if (damager instanceof Player) {
|
||||
boolean okay = true;
|
||||
if (plugin.citizens != null) {
|
||||
if (plugin.citizens.getNPCRegistry().isNPC(damager)) {
|
||||
if (Quests.citizens != null) {
|
||||
if (Quests.citizens.getNPCRegistry().isNPC(damager)) {
|
||||
okay = false;
|
||||
}
|
||||
}
|
||||
|
@ -108,9 +108,9 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : plugin.quests) {
|
||||
if (quest.guiDisplay != null) {
|
||||
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");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
} else if (quester.completedQuests.contains(quest.name) && quest.redoDelay < 0) {
|
||||
String completed = Lang.get(player, "questAlreadyCompleted");
|
||||
@ -241,9 +241,9 @@ public class PlayerListener implements Listener {
|
||||
for (final Quest q : plugin.quests) {
|
||||
if (q.blockStart != null) {
|
||||
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");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
} else {
|
||||
if (quester.completedQuests.contains(q.name)) {
|
||||
@ -492,7 +492,7 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
if (damager instanceof Player) {
|
||||
if (plugin.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(target)) {
|
||||
Quester quester = plugin.getQuester(damager.getUniqueId());
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
@ -642,11 +642,11 @@ public class PlayerListener implements Listener {
|
||||
quester.id = evt.getPlayer().getUniqueId();
|
||||
if (new File(plugin.getDataFolder(), "data" + File.separator + quester.id + ".yml").exists()) {
|
||||
quester.loadData();
|
||||
} else if (Quests.genFilesOnJoin) {
|
||||
} else if (plugin.genFilesOnJoin) {
|
||||
quester.saveData();
|
||||
}
|
||||
plugin.questers.put(evt.getPlayer().getUniqueId(), quester);
|
||||
if (Quests.useCompass) {
|
||||
if (plugin.useCompass) {
|
||||
quester.resetCompass();
|
||||
}
|
||||
for (String s : quester.completedQuests) {
|
||||
@ -710,7 +710,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
||||
boolean isPlayer = true;
|
||||
if (plugin.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(evt.getPlayer())) {
|
||||
isPlayer = false;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class Quest {
|
||||
if (stageCompleteMessage != null) {
|
||||
q.getPlayer().sendMessage(Quests.parseString(stageCompleteMessage, this));
|
||||
}
|
||||
if (Quests.useCompass) {
|
||||
if (plugin.useCompass) {
|
||||
q.resetCompass();
|
||||
q.findCompassTarget();
|
||||
}
|
||||
@ -165,7 +165,7 @@ public class Quest {
|
||||
}
|
||||
|
||||
public boolean updateCompass(Quester quester, Stage nextStage) {
|
||||
if (!Quests.useCompass)
|
||||
if (!plugin.useCompass)
|
||||
return false;
|
||||
Location targetLocation = null;
|
||||
if (nextStage == null) {
|
||||
|
@ -58,7 +58,7 @@ import net.citizensnpcs.api.CitizensAPI;
|
||||
|
||||
public class QuestFactory implements ConversationAbandonedListener {
|
||||
|
||||
public Quests quests;
|
||||
public final Quests plugin;
|
||||
Map<UUID, Quest> editSessions = new HashMap<UUID, Quest>();
|
||||
Map<UUID, Block> selectedBlockStarts = new HashMap<UUID, Block>();
|
||||
public Map<UUID, Block> selectedKillLocations = new HashMap<UUID, Block>();
|
||||
@ -68,9 +68,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
ConversationFactory convoCreator;
|
||||
File questsFile;
|
||||
|
||||
// TODO - @SuppressWarnings("LeakingThisInConstructor")
|
||||
public QuestFactory(Quests plugin) {
|
||||
quests = plugin;
|
||||
this.plugin = plugin;
|
||||
questsFile = new File(plugin.getDataFolder(), "quests.yml");
|
||||
// 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);
|
||||
@ -160,19 +159,19 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorRedoDelay") + " (" + Quests.getTime((Long) context.getSessionData(CK.Q_REDO_DELAY)) + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.Q_START_NPC) == null && quests.citizens != null) {
|
||||
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";
|
||||
} 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";
|
||||
}
|
||||
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";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + Lang.get("noneSet") + ")\n";
|
||||
}
|
||||
} else {
|
||||
if (quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
Location l = (Location) context.getSessionData(CK.Q_START_BLOCK);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")\n";
|
||||
} else {
|
||||
@ -182,13 +181,13 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
if (Quests.worldGuard != 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";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + Lang.get("noneSet") + ")\n";
|
||||
}
|
||||
} else {
|
||||
if (quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
String s = (String) context.getSessionData(CK.Q_REGION);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + ChatColor.GREEN + s + ChatColor.YELLOW + ")\n";
|
||||
} else {
|
||||
@ -197,20 +196,20 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
text += ChatColor.GRAY + "7 - " + Lang.get("questWGSetRegion") + " (" + Lang.get("questWGNotInstalled") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.GRAY + "6 - " + Lang.get("questWGSetRegion") + " (" + Lang.get("questWGNotInstalled") + ")\n";
|
||||
}
|
||||
}
|
||||
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";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + Lang.get("noneSet") + ")\n";
|
||||
}
|
||||
} else {
|
||||
if (quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
String s = (String) context.getSessionData(CK.Q_INITIAL_EVENT);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + s + ")\n";
|
||||
} else {
|
||||
@ -218,7 +217,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
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) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
@ -228,27 +227,27 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
} else {
|
||||
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";
|
||||
} else {
|
||||
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";
|
||||
} else {
|
||||
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";
|
||||
} else {
|
||||
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";
|
||||
} else {
|
||||
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";
|
||||
} else {
|
||||
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")) {
|
||||
return new RedoDelayPrompt();
|
||||
} else if (input.equalsIgnoreCase("5")) {
|
||||
if (quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
return new SetNpcStartPrompt();
|
||||
} else {
|
||||
selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
return new BlockStartPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("6")) {
|
||||
if (quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
return new BlockStartPrompt();
|
||||
} else if (Quests.worldGuard != null) {
|
||||
@ -283,51 +282,51 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("7")) {
|
||||
if (quests.citizens != null && Quests.worldGuard != null) {
|
||||
if (Quests.citizens != null && Quests.worldGuard != null) {
|
||||
return new RegionPrompt();
|
||||
} else if (quests.citizens != null) {
|
||||
} else if (Quests.citizens != null) {
|
||||
return new CreateMenuPrompt();
|
||||
} else {
|
||||
return new InitialEventPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
if (quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
return new InitialEventPrompt();
|
||||
} else {
|
||||
return new GUIDisplayPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("9")) {
|
||||
if (quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
return new GUIDisplayPrompt();
|
||||
} else {
|
||||
return new RequirementsPrompt(quests, QuestFactory.this);
|
||||
return new RequirementsPrompt(plugin, QuestFactory.this);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("10")) {
|
||||
if (quests.citizens != null) {
|
||||
return new RequirementsPrompt(quests, QuestFactory.this);
|
||||
if (Quests.citizens != null) {
|
||||
return new RequirementsPrompt(plugin, QuestFactory.this);
|
||||
} else {
|
||||
return new StagesPrompt(QuestFactory.this);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("11")) {
|
||||
if (quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
return new StagesPrompt(QuestFactory.this);
|
||||
} else {
|
||||
return new RewardsPrompt(quests, QuestFactory.this);
|
||||
return new RewardsPrompt(plugin, QuestFactory.this);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("12")) {
|
||||
if (quests.citizens != null) {
|
||||
return new RewardsPrompt(quests, QuestFactory.this);
|
||||
if (Quests.citizens != null) {
|
||||
return new RewardsPrompt(plugin, QuestFactory.this);
|
||||
} else {
|
||||
return new SavePrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("13")) {
|
||||
if (quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
return new SavePrompt();
|
||||
} else {
|
||||
return new ExitPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("14")) {
|
||||
if (quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
return new ExitPrompt();
|
||||
} else {
|
||||
return new CreateMenuPrompt();
|
||||
@ -342,7 +341,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
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";
|
||||
}
|
||||
return s + ChatColor.GOLD + Lang.get("questEditorEditEnterQuestName");
|
||||
@ -351,19 +350,19 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
for (Quest q : quests.getQuests()) {
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
if (q.getName().equalsIgnoreCase(input)) {
|
||||
loadQuest(context, q);
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
}
|
||||
for (Quest q : quests.getQuests()) {
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
if (q.getName().toLowerCase().startsWith(input.toLowerCase())) {
|
||||
loadQuest(context, q);
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
}
|
||||
for (Quest q : quests.getQuests()) {
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
if (q.getName().toLowerCase().contains(input.toLowerCase())) {
|
||||
loadQuest(context, q);
|
||||
return new CreateMenuPrompt();
|
||||
@ -389,7 +388,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
for (Quest q : quests.quests) {
|
||||
for (Quest q : plugin.quests) {
|
||||
if (q.name.equalsIgnoreCase(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNameExists"));
|
||||
return new QuestNamePrompt();
|
||||
@ -488,7 +487,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
for (Quest q : quests.quests) {
|
||||
for (Quest q : plugin.quests) {
|
||||
if (q.name.equalsIgnoreCase(input)) {
|
||||
String s = null;
|
||||
if (context.getSessionData(CK.ED_QUEST_EDIT) != null) {
|
||||
@ -565,10 +564,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.DARK_GREEN + Lang.get("eventTitle") + "\n";
|
||||
if (quests.events.isEmpty()) {
|
||||
if (plugin.events.isEmpty()) {
|
||||
text += ChatColor.RED + "- " + Lang.get("none");
|
||||
} else {
|
||||
for (Event e : quests.events) {
|
||||
for (Event e : plugin.events) {
|
||||
text += ChatColor.GREEN + "- " + e.getName() + "\n";
|
||||
}
|
||||
}
|
||||
@ -580,7 +579,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
Event found = null;
|
||||
for (Event e : quests.events) {
|
||||
for (Event e : plugin.events) {
|
||||
if (e.getName().equalsIgnoreCase(input)) {
|
||||
found = e;
|
||||
break;
|
||||
@ -614,7 +613,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (context.getSessionData("tempStack") != null) {
|
||||
ItemStack stack = (ItemStack) context.getSessionData("tempStack");
|
||||
boolean failed = false;
|
||||
for (Quest quest : quests.quests) {
|
||||
for (Quest quest : plugin.quests) {
|
||||
if (quest.guiDisplay != null) {
|
||||
if (ItemUtil.compareItems(stack, quest.guiDisplay, false) == 0) {
|
||||
String error = Lang.get("questGUIError");
|
||||
@ -663,7 +662,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.DARK_GREEN + Lang.get("questRegionTitle") + "\n";
|
||||
boolean any = false;
|
||||
for (World world : quests.getServer().getWorlds()) {
|
||||
for (World world : plugin.getServer().getWorlds()) {
|
||||
RegionManager rm = Quests.worldGuard.getRegionManager(world);
|
||||
for (String region : rm.getRegions().keySet()) {
|
||||
any = true;
|
||||
@ -685,7 +684,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
String found = null;
|
||||
boolean done = false;
|
||||
for (World world : quests.getServer().getWorlds()) {
|
||||
for (World world : plugin.getServer().getWorlds()) {
|
||||
RegionManager rm = Quests.worldGuard.getRegionManager(world);
|
||||
for (String region : rm.getRegions().keySet()) {
|
||||
if (region.equalsIgnoreCase(input)) {
|
||||
@ -774,7 +773,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
FileConfiguration data = new YamlConfiguration();
|
||||
try {
|
||||
data.load(new File(quests.getDataFolder(), "quests.yml"));
|
||||
data.load(new File(plugin.getDataFolder(), "quests.yml"));
|
||||
ConfigurationSection questSection = data.getConfigurationSection("quests");
|
||||
int customNum = 1;
|
||||
while (true) {
|
||||
@ -786,13 +785,13 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
ConfigurationSection newSection = questSection.createSection("custom" + customNum);
|
||||
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) {
|
||||
int i = (Integer) context.getSessionData(CK.Q_START_NPC);
|
||||
if (!quests.questNPCGUIs.contains(i)) {
|
||||
quests.questNPCGUIs.add(i);
|
||||
if (!plugin.questNPCGUIs.contains(i)) {
|
||||
plugin.questNPCGUIs.add(i);
|
||||
}
|
||||
quests.updateData();
|
||||
plugin.updateData();
|
||||
}
|
||||
context.getForWhom().sendRawMessage(ChatColor.GREEN
|
||||
+ Lang.get("questEditorSaved").replaceAll("<command>", "/questadmin " + Lang.get("COMMAND_QUESTADMIN_RELOAD")));
|
||||
@ -1736,7 +1735,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
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 = text.substring(0, text.length() - 1) + "\n";
|
||||
@ -1748,9 +1747,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> used = new LinkedList<String>();
|
||||
Quest found = quests.findQuest(input);
|
||||
Quest found = plugin.findQuest(input);
|
||||
if (found != null) {
|
||||
for (Quest q : quests.quests) {
|
||||
for (Quest q : plugin.quests) {
|
||||
if (q.neededQuests.contains(q.name) || q.blockQuests.contains(q.name)) {
|
||||
used.add(q.name);
|
||||
}
|
||||
@ -1824,7 +1823,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
return;
|
||||
}
|
||||
quests.reloadQuests();
|
||||
plugin.reloadQuests();
|
||||
context.getForWhom().sendRawMessage(ChatColor.GREEN + Lang.get("questDeleted"));
|
||||
}
|
||||
}
|
||||
|
@ -1091,7 +1091,7 @@ public class Quester {
|
||||
getQuestData(quest).itemsDelivered.put(found, (amount + i.getAmount()));
|
||||
player.getInventory().setItem(player.getInventory().first(i), null);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -2490,7 +2490,7 @@ public class Quester {
|
||||
if (!meta.hasLore()) {
|
||||
LinkedList<String> lines = new LinkedList<String>();
|
||||
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);
|
||||
} else {
|
||||
lines = MiscUtil.makeLines(desc, " ", 40, null);
|
||||
@ -2559,7 +2559,7 @@ public class Quester {
|
||||
}
|
||||
|
||||
public void resetCompass() {
|
||||
if (!Quests.useCompass)
|
||||
if (!plugin.useCompass)
|
||||
return;
|
||||
Player player = getPlayer();
|
||||
if (player == null)
|
||||
@ -2572,7 +2572,7 @@ public class Quester {
|
||||
}
|
||||
|
||||
public void findCompassTarget() {
|
||||
if (!Quests.useCompass)
|
||||
if (!plugin.useCompass)
|
||||
return;
|
||||
Player player = getPlayer();
|
||||
if (player == null)
|
||||
|
@ -109,6 +109,7 @@ import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
public class Quests extends JavaPlugin implements ConversationAbandonedListener {
|
||||
|
||||
// Dependencies
|
||||
public static Economy economy = null;
|
||||
public static Permission permission = null;
|
||||
public static WorldGuardPlugin worldGuard = null;
|
||||
@ -116,15 +117,30 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
public static Heroes heroes = null;
|
||||
public static PhatLoots phatLoots = null;
|
||||
public static PlaceholderAPIPlugin placeholder = null;
|
||||
public static boolean npcEffects = true;
|
||||
public static boolean useCompass = true;
|
||||
public static boolean ignoreLockedQuests = false;
|
||||
public static boolean genFilesOnJoin = true;
|
||||
public static boolean askConfirmation = true;
|
||||
public static int acceptTimeout = 20;
|
||||
public static int maxQuests = 0;
|
||||
public static String effect = "note";
|
||||
public static String redoEffect = "angry_villager";
|
||||
public static Vault vault = null;
|
||||
public static CitizensPlugin citizens;
|
||||
public static Denizen denizen = null;
|
||||
// Config settings
|
||||
public int acceptTimeout = 20;
|
||||
public boolean allowCommands = true;
|
||||
public boolean allowCommandsForNpcQuests = false;
|
||||
public boolean allowQuitting = true;
|
||||
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 List<String> questerBlacklist = new LinkedList<String>();
|
||||
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<NPC> questNPCs = new LinkedList<NPC>();
|
||||
public final LinkedList<Integer> questNPCGUIs = new LinkedList<Integer>();
|
||||
// Classes
|
||||
public ConversationFactory conversationFactory;
|
||||
public ConversationFactory NPCConversationFactory;
|
||||
public QuestFactory questFactory;
|
||||
public EventFactory eventFactory;
|
||||
public Vault vault = null;
|
||||
public CitizensPlugin citizens;
|
||||
public PlayerListener pListener;
|
||||
public NpcListener npcListener;
|
||||
public NpcEffectThread effListener;
|
||||
public Denizen denizen = null;
|
||||
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 HashMap<String, Integer> commands = new HashMap<String, Integer>();
|
||||
public HashMap<String, Integer> adminCommands = new HashMap<String, Integer>();
|
||||
private static Quests instance = null;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class StageFailedException extends Exception {
|
||||
@ -171,7 +173,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
pListener = new PlayerListener(this);
|
||||
effListener = new NpcEffectThread(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.NPCConversationFactory = new ConversationFactory(this).withModality(false).withFirstPrompt(new QuestAcceptPrompt(this)).withTimeout(acceptTimeout).withLocalEcho(false).addConversationAbandonedListener(this);
|
||||
questFactory = new QuestFactory(this);
|
||||
@ -207,12 +208,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
delayLoadQuestInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer language files from jar to disk
|
||||
*/
|
||||
private void setupLang() throws IOException, URISyntaxException {
|
||||
final String path = "lang";
|
||||
final File jarFile = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath());
|
||||
if(jarFile.isFile()) {
|
||||
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>();
|
||||
while(entries.hasMoreElements()) {
|
||||
final String name = entries.nextElement().getName();
|
||||
@ -305,30 +309,58 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
public void loadCommands() {
|
||||
// [] - required
|
||||
// {} - optional
|
||||
commands.put(Lang.get("COMMAND_LIST"), 1); // list {page}
|
||||
commands.put(Lang.get("COMMAND_TAKE"), 2); // take [quest]
|
||||
commands.put(Lang.get("COMMAND_QUIT"), 2); // quit [quest]
|
||||
commands.put(Lang.get("COMMAND_EDITOR"), 1); // editor
|
||||
commands.put(Lang.get("COMMAND_EVENTS_EDITOR"), 1); // events
|
||||
commands.put(Lang.get("COMMAND_STATS"), 1); // stats
|
||||
commands.put(Lang.get("COMMAND_TOP"), 2); // top [number]
|
||||
commands.put(Lang.get("COMMAND_INFO"), 1); // info
|
||||
commands.put(Lang.get("COMMAND_JOURNAL"), 1); // journal
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_STATS"), 2); // stats [player]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_GIVE"), 3); // give [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_QUIT"), 3); // quit [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_REMOVE"), 3); // remove [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_POINTS"), 3); // points [player] [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS"), 3); // takepoints [player] [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS"), 3); // givepoints [player] [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_POINTSALL"), 2); // pointsall [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_FINISH"), 3); // finish [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_PURGE"), 2); // purge [player]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_RESET"), 2); // purge [player]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI"), 2); // togglegui [npc id]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_RELOAD"), 1); // reload
|
||||
if (translateSubCommands) {
|
||||
commands.put(Lang.get("COMMAND_LIST"), 1); // list {page}
|
||||
commands.put(Lang.get("COMMAND_TAKE"), 2); // take [quest]
|
||||
commands.put(Lang.get("COMMAND_QUIT"), 2); // quit [quest]
|
||||
commands.put(Lang.get("COMMAND_EDITOR"), 1); // editor
|
||||
commands.put(Lang.get("COMMAND_EVENTS_EDITOR"), 1); // events
|
||||
commands.put(Lang.get("COMMAND_STATS"), 1); // stats
|
||||
commands.put(Lang.get("COMMAND_TOP"), 2); // top [number]
|
||||
commands.put(Lang.get("COMMAND_INFO"), 1); // info
|
||||
commands.put(Lang.get("COMMAND_JOURNAL"), 1); // journal
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_STATS"), 2); // stats [player]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_GIVE"), 3); // give [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_QUIT"), 3); // quit [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_REMOVE"), 3); // remove [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_POINTS"), 3); // points [player] [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS"), 3); // takepoints [player] [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS"), 3); // givepoints [player] [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_POINTSALL"), 2); // pointsall [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_FINISH"), 3); // finish [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_PURGE"), 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_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) {
|
||||
@ -432,8 +464,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
|
||||
public static Quests getInstance() {
|
||||
return instance;
|
||||
public Quests getInstance() {
|
||||
return this;
|
||||
}
|
||||
|
||||
private class QuestPrompt extends StringPrompt {
|
||||
@ -473,28 +505,29 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
|
||||
public void loadConfig() {
|
||||
FileConfiguration config = getConfig();
|
||||
if (config.getString("language").equalsIgnoreCase("en")) {
|
||||
//Legacy
|
||||
Lang.iso = "en-US";
|
||||
} else {
|
||||
Lang.iso = config.getString("language", "en-US");
|
||||
}
|
||||
acceptTimeout = config.getInt("accept-timeout", 20);
|
||||
allowCommands = config.getBoolean("allow-command-questing", true);
|
||||
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);
|
||||
useCompass = config.getBoolean("use-compass", true);
|
||||
genFilesOnJoin = config.getBoolean("generate-files-on-join", 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);
|
||||
effect = config.getString("npc-effects.new-quest", "note");
|
||||
redoEffect = config.getString("npc-effects.redo-quest", "angry_villager");
|
||||
killDelay = config.getInt("kill-delay", 600);
|
||||
acceptTimeout = config.getInt("accept-timeout", 20);
|
||||
convertData = config.getBoolean("convert-data-on-startup", false);
|
||||
ignoreLockedQuests = config.getBoolean("ignore-locked-quests", false);
|
||||
maxQuests = config.getInt("max-quests", maxQuests);
|
||||
showQuestReqs = config.getBoolean("show-requirements", true);
|
||||
showQuestTitles = config.getBoolean("show-titles", true);
|
||||
translateSubCommands = config.getBoolean("translate-subcommands", false);
|
||||
useCompass = config.getBoolean("use-compass", true);
|
||||
for (String s : config.getStringList("quester-blacklist")) {
|
||||
if (!s.equalsIgnoreCase("UUID")) {
|
||||
questerBlacklist.add(s);
|
||||
@ -526,9 +559,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
File f = new File(this.getDataFolder(), "modules");
|
||||
if (f.exists() && f.isDirectory()) {
|
||||
File[] modules = f.listFiles();
|
||||
for (File module : modules) {
|
||||
if (module.isDirectory() == false && module.getName().endsWith(".jar")) {
|
||||
loadModule(module);
|
||||
if (modules != null) {
|
||||
for (File module : modules) {
|
||||
if (module.isDirectory() == false && module.getName().endsWith(".jar")) {
|
||||
loadModule(module);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -601,31 +636,40 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
player.sendMessage(ChatColor.GOLD + Lang.get(player, "questHelpTitle"));
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "questDisplayHelp"));
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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(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(ChatColor.YELLOW + "/quest " + Lang.get(player, "COMMAND_QUEST_HELP"));
|
||||
if (player.hasPermission("quests.questinfo")) {
|
||||
@ -675,36 +719,36 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
adminHelp(cs);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_RELOAD"))) {
|
||||
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"))) {
|
||||
if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats")) {
|
||||
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);
|
||||
} 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 {
|
||||
cs.sendMessage(ChatColor.YELLOW + Lang.get("questsUnknownAdminCommand"));
|
||||
}
|
||||
@ -944,39 +988,42 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
File questerFolder = new File(Quests.this.getDataFolder(), "data");
|
||||
File questerFolder = new File(getDataFolder(), "data");
|
||||
if (questerFolder.exists() && questerFolder.isDirectory()) {
|
||||
FileConfiguration data = new YamlConfiguration();
|
||||
File[] files = questerFolder.listFiles();
|
||||
int failCount = 0;
|
||||
boolean suppressed = false;
|
||||
for (File f : questerFolder.listFiles()) {
|
||||
try {
|
||||
data.load(f);
|
||||
data.set("quest-points", amount);
|
||||
data.save(f);
|
||||
} catch (IOException e) {
|
||||
if (failCount < 10) {
|
||||
String msg = Lang.get("errorReading");
|
||||
msg = msg.replaceAll("<file>", ChatColor.DARK_AQUA + f.getName() + ChatColor.RED);
|
||||
cs.sendMessage(ChatColor.RED + msg);
|
||||
failCount++;
|
||||
} else if (suppressed == false) {
|
||||
String msg = Lang.get("errorReadingSuppress");
|
||||
msg = msg.replaceAll("<file>", ChatColor.DARK_AQUA + f.getName() + ChatColor.RED);
|
||||
cs.sendMessage(ChatColor.RED + msg);
|
||||
suppressed = true;
|
||||
}
|
||||
} catch (InvalidConfigurationException e) {
|
||||
if (failCount < 10) {
|
||||
String msg = Lang.get("errorReading");
|
||||
msg = msg.replaceAll("<file>", ChatColor.DARK_AQUA + f.getName() + ChatColor.RED);
|
||||
cs.sendMessage(ChatColor.RED + msg);
|
||||
failCount++;
|
||||
} else if (suppressed == false) {
|
||||
String msg = Lang.get("errorReadingSuppress");
|
||||
msg = msg.replaceAll("<file>", ChatColor.DARK_AQUA + f.getName() + ChatColor.RED);
|
||||
cs.sendMessage(ChatColor.RED + msg);
|
||||
suppressed = true;
|
||||
if (files != null) {
|
||||
for (File f : files) {
|
||||
try {
|
||||
data.load(f);
|
||||
data.set("quest-points", amount);
|
||||
data.save(f);
|
||||
} catch (IOException e) {
|
||||
if (failCount < 10) {
|
||||
String msg = Lang.get("errorReading");
|
||||
msg = msg.replaceAll("<file>", ChatColor.DARK_AQUA + f.getName() + ChatColor.RED);
|
||||
cs.sendMessage(ChatColor.RED + msg);
|
||||
failCount++;
|
||||
} else if (suppressed == false) {
|
||||
String msg = Lang.get("errorReadingSuppress");
|
||||
msg = msg.replaceAll("<file>", ChatColor.DARK_AQUA + f.getName() + ChatColor.RED);
|
||||
cs.sendMessage(ChatColor.RED + msg);
|
||||
suppressed = true;
|
||||
}
|
||||
} catch (InvalidConfigurationException e) {
|
||||
if (failCount < 10) {
|
||||
String msg = Lang.get("errorReading");
|
||||
msg = msg.replaceAll("<file>", ChatColor.DARK_AQUA + f.getName() + ChatColor.RED);
|
||||
cs.sendMessage(ChatColor.RED + msg);
|
||||
failCount++;
|
||||
} else if (suppressed == false) {
|
||||
String msg = Lang.get("errorReadingSuppress");
|
||||
msg = msg.replaceAll("<file>", ChatColor.DARK_AQUA + f.getName() + ChatColor.RED);
|
||||
cs.sendMessage(ChatColor.RED + msg);
|
||||
suppressed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1378,17 +1425,19 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
File folder = new File(this.getDataFolder(), "data");
|
||||
File[] playerFiles = folder.listFiles();
|
||||
Map<String, Integer> questPoints = new HashMap<String, Integer>();
|
||||
for (File f : playerFiles) {
|
||||
FileConfiguration data = new YamlConfiguration();
|
||||
try {
|
||||
data.load(f);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
if (playerFiles != null) {
|
||||
for (File f : playerFiles) {
|
||||
FileConfiguration data = new YamlConfiguration();
|
||||
try {
|
||||
data.load(f);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String name = f.getName().substring(0, (f.getName().indexOf(".")));
|
||||
questPoints.put(name, data.getInt("quest-points"));
|
||||
}
|
||||
String name = f.getName().substring(0, (f.getName().indexOf(".")));
|
||||
questPoints.put(name, data.getInt("quest-points"));
|
||||
}
|
||||
LinkedHashMap<String, Integer> sortedMap = (LinkedHashMap<String, Integer>) Quests.sort(questPoints);
|
||||
int numPrinted = 0;
|
||||
@ -1884,66 +1933,96 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
cs.sendMessage("");
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin" + ChatColor.RED + " " + Lang.get("COMMAND_QUESTADMIN_HELP"));
|
||||
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_GIVE_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_POINTS_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_GIVEPOINTS_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_FINISH_HELP"));
|
||||
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_SETSTAGE_HELP"));
|
||||
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_RESET_HELP"));
|
||||
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_TOGGLEGUI_HELP"));
|
||||
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_STATS_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVE_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE") : "give"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_QUIT_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT") : "quit"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTS_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTSALL_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall"));
|
||||
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 {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI_HELP"));
|
||||
if (cs.hasPermission("quests.admin.togglegui")) {
|
||||
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")) {
|
||||
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() {
|
||||
boolean failedToLoad;
|
||||
totalQuestPoints = 0;
|
||||
needsSaving = false;
|
||||
FileConfiguration config = null;
|
||||
File file = new File(this.getDataFolder(), "quests.yml");
|
||||
@ -2125,7 +2203,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
quest.guiDisplay = stack;
|
||||
}
|
||||
} 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")) {
|
||||
@ -2232,7 +2310,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (config.contains("quests." + questName + ".rewards.quest-points")) {
|
||||
if (config.getInt("quests." + questName + ".rewards.quest-points", -999) != -999) {
|
||||
quest.questPoints = config.getInt("quests." + questName + ".rewards.quest-points");
|
||||
totalQuestPoints += quest.questPoints;
|
||||
} else {
|
||||
skipQuestProcess("quest-points: Reward in Quest " + quest.name + " is not a number!");
|
||||
}
|
||||
@ -4053,77 +4130,80 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
return dir.getPath().equals(dataFolder.getPath()) && name.endsWith(".yml");
|
||||
}
|
||||
});
|
||||
numQuesters = files.length;
|
||||
if (numQuesters > 0) {
|
||||
final ArrayList<String> names = new ArrayList<String>();
|
||||
getLogger().info("Gathering Quester information...");
|
||||
for (int i = 0; i < numQuesters; i++) {
|
||||
final File file = files[i];
|
||||
final File old = new File(oldDataFolder, file.getName());
|
||||
final String name = file.getName().substring(0, file.getName().length() - 4);
|
||||
final FileConfiguration config = new YamlConfiguration();
|
||||
try {
|
||||
config.load(file);
|
||||
config.save(old);
|
||||
config.set("lastKnownName", name);
|
||||
config.save(file);
|
||||
} catch (Exception e) {
|
||||
failed++;
|
||||
}
|
||||
names.add(name.toLowerCase());
|
||||
succeeded++;
|
||||
}
|
||||
getLogger().info("Completed: " + succeeded + " Success(es). " + failed + " Failure(s). " + numQuesters + " Total.");
|
||||
getLogger().info("Preparing to convert data.");
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
getLogger().info("Done. Converting data...");
|
||||
int converted = 0;
|
||||
int failed = 0;
|
||||
final UUIDFetcher fetcher = new UUIDFetcher(names);
|
||||
final Map<String, UUID> idMap;
|
||||
|
||||
if (files != null) {
|
||||
numQuesters = files.length;
|
||||
if (numQuesters > 0) {
|
||||
final ArrayList<String> names = new ArrayList<String>();
|
||||
getLogger().info("Gathering Quester information...");
|
||||
for (int i = 0; i < numQuesters; i++) {
|
||||
final File file = files[i];
|
||||
final File old = new File(oldDataFolder, file.getName());
|
||||
final String name = file.getName().substring(0, file.getName().length() - 4);
|
||||
final FileConfiguration config = new YamlConfiguration();
|
||||
try {
|
||||
idMap = fetcher.call();
|
||||
} catch (Exception ex) {
|
||||
getLogger().severe("Error retrieving data from Mojang account database. Error log:");
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
config.load(file);
|
||||
config.save(old);
|
||||
config.set("lastKnownName", name);
|
||||
config.save(file);
|
||||
} catch (Exception e) {
|
||||
failed++;
|
||||
}
|
||||
for (Entry<String, UUID> entry : idMap.entrySet()) {
|
||||
try {
|
||||
final File found = new File(dataFolder, entry.getKey() + ".yml");
|
||||
final File copy = new File(dataFolder, entry.getValue() + ".yml");
|
||||
final FileConfiguration config = new YamlConfiguration();
|
||||
final FileConfiguration newConfig = new YamlConfiguration();
|
||||
config.load(found);
|
||||
if (config.contains("currentQuest")) {
|
||||
LinkedList<String> currentQuests = new LinkedList<String>();
|
||||
currentQuests.add(config.getString("currentQuest"));
|
||||
LinkedList<Integer> currentStages = new LinkedList<Integer>();
|
||||
currentStages.add(config.getInt("currentStage"));
|
||||
newConfig.set("currentQuests", currentQuests);
|
||||
newConfig.set("currentStages", currentStages);
|
||||
newConfig.set("hasJournal", false);
|
||||
newConfig.set("lastKnownName", entry.getKey());
|
||||
ConfigurationSection dataSec = Quester.getLegacyQuestData(config, config.getString("currentQuest"));
|
||||
newConfig.set("questData", dataSec);
|
||||
}
|
||||
newConfig.save(copy);
|
||||
found.delete();
|
||||
converted++;
|
||||
} catch (Exception ex) {
|
||||
failed++;
|
||||
}
|
||||
}
|
||||
getLogger().info("Conversion completed: " + converted + " Converted. " + failed + " Failed.");
|
||||
getLogger().info("Old data files stored in "
|
||||
+ File.separator + "Quests" + File.separator + "data" + File.separator + "old");
|
||||
names.add(name.toLowerCase());
|
||||
succeeded++;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
getLogger().info("No Questers to convert!");
|
||||
getLogger().info("Completed: " + succeeded + " Success(es). " + failed + " Failure(s). " + numQuesters + " Total.");
|
||||
getLogger().info("Preparing to convert data.");
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
getLogger().info("Done. Converting data...");
|
||||
int converted = 0;
|
||||
int failed = 0;
|
||||
final UUIDFetcher fetcher = new UUIDFetcher(names);
|
||||
final Map<String, UUID> idMap;
|
||||
try {
|
||||
idMap = fetcher.call();
|
||||
} catch (Exception ex) {
|
||||
getLogger().severe("Error retrieving data from Mojang account database. Error log:");
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
for (Entry<String, UUID> entry : idMap.entrySet()) {
|
||||
try {
|
||||
final File found = new File(dataFolder, entry.getKey() + ".yml");
|
||||
final File copy = new File(dataFolder, entry.getValue() + ".yml");
|
||||
final FileConfiguration config = new YamlConfiguration();
|
||||
final FileConfiguration newConfig = new YamlConfiguration();
|
||||
config.load(found);
|
||||
if (config.contains("currentQuest")) {
|
||||
LinkedList<String> currentQuests = new LinkedList<String>();
|
||||
currentQuests.add(config.getString("currentQuest"));
|
||||
LinkedList<Integer> currentStages = new LinkedList<Integer>();
|
||||
currentStages.add(config.getInt("currentStage"));
|
||||
newConfig.set("currentQuests", currentQuests);
|
||||
newConfig.set("currentStages", currentStages);
|
||||
newConfig.set("hasJournal", false);
|
||||
newConfig.set("lastKnownName", entry.getKey());
|
||||
ConfigurationSection dataSec = Quester.getLegacyQuestData(config, config.getString("currentQuest"));
|
||||
newConfig.set("questData", dataSec);
|
||||
}
|
||||
newConfig.save(copy);
|
||||
found.delete();
|
||||
converted++;
|
||||
} catch (Exception ex) {
|
||||
failed++;
|
||||
}
|
||||
}
|
||||
getLogger().info("Conversion completed: " + converted + " Converted. " + failed + " Failed.");
|
||||
getLogger().info("Old data files stored in "
|
||||
+ File.separator + "Quests" + File.separator + "data" + File.separator + "old");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
getLogger().info("No Questers to convert!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getLogger().info("Data folder does not exist!");
|
||||
|
@ -62,7 +62,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
this.questFactory = qf;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "deprecation" })
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
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";
|
||||
}
|
||||
}
|
||||
if (questFactory.quests.citizens != null) {
|
||||
if (Quests.citizens != 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";
|
||||
} else {
|
||||
@ -164,7 +164,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
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) {
|
||||
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "10 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorTalkToNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
@ -178,7 +178,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
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) {
|
||||
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "11 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorKillNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
@ -264,7 +264,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
} 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";
|
||||
}
|
||||
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";
|
||||
} else {
|
||||
if (context.getSessionData(pref + CK.S_DENIZEN) == null) {
|
||||
@ -354,21 +354,21 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
return new EnchantmentListPrompt();
|
||||
} else if (input.equalsIgnoreCase("9")) {
|
||||
if (questFactory.quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
return new DeliveryListPrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("10")) {
|
||||
if (questFactory.quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
return new NPCIDsToTalkToPrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("11")) {
|
||||
if (questFactory.quests.citizens != null) {
|
||||
if (Quests.citizens != null) {
|
||||
return new NPCKillListPrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||
@ -394,7 +394,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
return new DelayMessagePrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("19")) {
|
||||
if (questFactory.quests.denizen == null) {
|
||||
if (Quests.denizen == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDenizen"));
|
||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||
} else {
|
||||
@ -610,6 +610,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
super("1", "2", "3", "4", "5");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorBreakBlocks") + " -\n";
|
||||
@ -827,6 +828,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
super("1", "2", "3", "4", "5");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorDamageBlocks") + " -\n";
|
||||
@ -1044,6 +1046,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
super("1", "2", "3", "4", "5");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorPlaceBlocks") + " -\n";
|
||||
@ -1261,6 +1264,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
super("1", "2", "3", "4", "5");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorUseBlocks") + " -\n";
|
||||
@ -1478,6 +1482,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
super("1", "2", "3", "4", "5");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorCutBlocks") + " -\n";
|
||||
@ -1741,6 +1746,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
super("1", "2", "3", "4", "5");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorEnchantItems") + " -\n";
|
||||
@ -3253,10 +3259,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorStartEvent") + " -\n";
|
||||
if (questFactory.quests.events.isEmpty()) {
|
||||
if (questFactory.plugin.events.isEmpty()) {
|
||||
text += ChatColor.RED + "- None";
|
||||
} else {
|
||||
for (Event e : questFactory.quests.events) {
|
||||
for (Event e : questFactory.plugin.events) {
|
||||
text += ChatColor.GREEN + "- " + e.getName() + "\n";
|
||||
}
|
||||
}
|
||||
@ -3268,7 +3274,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
Event found = null;
|
||||
for (Event e : questFactory.quests.events) {
|
||||
for (Event e : questFactory.plugin.events) {
|
||||
if (e.getName().equalsIgnoreCase(input)) {
|
||||
found = e;
|
||||
break;
|
||||
@ -3298,10 +3304,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
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");
|
||||
} else {
|
||||
for (Event e : questFactory.quests.events) {
|
||||
for (Event e : questFactory.plugin.events) {
|
||||
text += ChatColor.GREEN + "- " + e.getName() + "\n";
|
||||
}
|
||||
}
|
||||
@ -3313,7 +3319,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
Event found = null;
|
||||
for (Event e : questFactory.quests.events) {
|
||||
for (Event e : questFactory.plugin.events) {
|
||||
if (e.getName().equalsIgnoreCase(input)) {
|
||||
found = e;
|
||||
break;
|
||||
@ -3343,10 +3349,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.DARK_GREEN + "- " + Lang.get("stageEditorDeathEvent") + " -\n";
|
||||
if (questFactory.quests.events.isEmpty()) {
|
||||
if (questFactory.plugin.events.isEmpty()) {
|
||||
text += ChatColor.RED + "- None";
|
||||
} else {
|
||||
for (Event e : questFactory.quests.events) {
|
||||
for (Event e : questFactory.plugin.events) {
|
||||
text += ChatColor.GREEN + "- " + e.getName() + "\n";
|
||||
}
|
||||
}
|
||||
@ -3358,7 +3364,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
Event found = null;
|
||||
for (Event e : questFactory.quests.events) {
|
||||
for (Event e : questFactory.plugin.events) {
|
||||
if (e.getName().equalsIgnoreCase(input)) {
|
||||
found = e;
|
||||
break;
|
||||
@ -3388,10 +3394,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
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");
|
||||
} else {
|
||||
for (Event e : questFactory.quests.events) {
|
||||
for (Event e : questFactory.plugin.events) {
|
||||
text += ChatColor.GREEN + "- " + e.getName() + "\n";
|
||||
}
|
||||
}
|
||||
@ -3403,7 +3409,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
Event found = null;
|
||||
for (Event e : questFactory.quests.events) {
|
||||
for (Event e : questFactory.plugin.events) {
|
||||
if (e.getName().equalsIgnoreCase(input)) {
|
||||
found = e;
|
||||
break;
|
||||
@ -3433,10 +3439,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
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");
|
||||
} else {
|
||||
for (Event e : questFactory.quests.events) {
|
||||
for (Event e : questFactory.plugin.events) {
|
||||
text += ChatColor.GREEN + "- " + e.getName() + "\n";
|
||||
}
|
||||
}
|
||||
@ -3448,7 +3454,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
Event found = null;
|
||||
for (Event e : questFactory.quests.events) {
|
||||
for (Event e : questFactory.plugin.events) {
|
||||
if (e.getName().equalsIgnoreCase(input)) {
|
||||
found = e;
|
||||
break;
|
||||
@ -3520,10 +3526,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
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");
|
||||
} else {
|
||||
for (Event e : questFactory.quests.events) {
|
||||
for (Event e : questFactory.plugin.events) {
|
||||
text += ChatColor.GREEN + "- " + e.getName() + "\n";
|
||||
}
|
||||
}
|
||||
@ -3535,7 +3541,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
Event found = null;
|
||||
for (Event e : questFactory.quests.events) {
|
||||
for (Event e : questFactory.plugin.events) {
|
||||
if (e.getName().equalsIgnoreCase(input)) {
|
||||
found = e;
|
||||
break;
|
||||
@ -3769,10 +3775,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
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") + ") ";
|
||||
} else {
|
||||
for (CustomObjective co : questFactory.quests.customObjectives) {
|
||||
for (CustomObjective co : questFactory.plugin.customObjectives) {
|
||||
text += ChatColor.DARK_PURPLE + " - " + co.getName() + "\n";
|
||||
}
|
||||
}
|
||||
@ -3784,14 +3790,14 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
CustomObjective found = null;
|
||||
for (CustomObjective co : questFactory.quests.customObjectives) {
|
||||
for (CustomObjective co : questFactory.plugin.customObjectives) {
|
||||
if (co.getName().equalsIgnoreCase(input)) {
|
||||
found = co;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found == null) {
|
||||
for (CustomObjective co : questFactory.quests.customObjectives) {
|
||||
for (CustomObjective co : questFactory.plugin.customObjectives) {
|
||||
if (co.getName().toLowerCase().contains(input.toLowerCase())) {
|
||||
found = co;
|
||||
break;
|
||||
@ -3857,7 +3863,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
String objName = list.getLast();
|
||||
text += objName + " -\n";
|
||||
CustomObjective found = null;
|
||||
for (CustomObjective co : questFactory.quests.customObjectives) {
|
||||
for (CustomObjective co : questFactory.plugin.customObjectives) {
|
||||
if (co.getName().equals(objName)) {
|
||||
found = co;
|
||||
break;
|
||||
@ -3879,7 +3885,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
LinkedList<String> list = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
|
||||
String objName = list.getLast();
|
||||
CustomObjective found = null;
|
||||
for (CustomObjective co : questFactory.quests.customObjectives) {
|
||||
for (CustomObjective co : questFactory.plugin.customObjectives) {
|
||||
if (co.getName().equals(objName)) {
|
||||
found = co;
|
||||
break;
|
||||
|
@ -37,7 +37,7 @@ import me.blackvein.quests.util.Lang;
|
||||
|
||||
public class ItemStackPrompt extends FixedSetPrompt {
|
||||
|
||||
// Stores itemstack in "tempStack" context data.
|
||||
// Stores ItemStack in "tempStack" context data
|
||||
// Stores name in "tempName"
|
||||
// Stores amount in "tempAmount"
|
||||
// Stores data in "tempData"
|
||||
@ -426,6 +426,7 @@ public class ItemStackPrompt extends FixedSetPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private String getItemData(ConversationContext cc) {
|
||||
if (cc.getSessionData("tempName") != null) {
|
||||
String item;
|
||||
|
@ -101,14 +101,14 @@ public class QuestAcceptPrompt extends StringPrompt {
|
||||
} else {
|
||||
Player player = quester.getPlayer();
|
||||
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)) {
|
||||
quester.questToTake = q.name;
|
||||
String s = extracted(quester);
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
if (!Quests.askConfirmation) {
|
||||
if (!plugin.askConfirmation) {
|
||||
plugin.getQuester(player.getUniqueId()).takeQuest(plugin.getQuest(plugin.getQuester(player.getUniqueId()).questToTake), false);
|
||||
} else {
|
||||
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||
@ -118,11 +118,11 @@ public class QuestAcceptPrompt extends StringPrompt {
|
||||
}
|
||||
} else if (quester.currentQuests.containsKey(q) == false) {
|
||||
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);
|
||||
}
|
||||
} 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) {
|
||||
String early = Lang.get("questTooEarly");
|
||||
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>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
if (!Quests.askConfirmation) {
|
||||
if (!plugin.askConfirmation) {
|
||||
plugin.getQuester(player.getUniqueId()).takeQuest(plugin.getQuest(plugin.getQuester(player.getUniqueId()).questToTake), false);
|
||||
} else {
|
||||
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||
@ -146,7 +146,7 @@ public class QuestAcceptPrompt extends StringPrompt {
|
||||
}
|
||||
} else if (quester.currentQuests.containsKey(q) == false) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
|
||||
import me.blackvein.quests.QuestFactory;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
|
||||
@ -55,9 +56,9 @@ public class StagesPrompt extends StringPrompt {
|
||||
if (i < 0) {
|
||||
return new StagesPrompt(questFactory);
|
||||
} 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)) {
|
||||
return new CreateStagePrompt((stages + 1), questFactory, questFactory.quests.citizens);
|
||||
return new CreateStagePrompt((stages + 1), questFactory, Quests.citizens);
|
||||
} else if (i == (stages + 2)) {
|
||||
return questFactory.returnToMenu();
|
||||
} else {
|
||||
|
@ -32,7 +32,7 @@ import me.clip.placeholderapi.PlaceholderAPI;
|
||||
|
||||
public class Lang {
|
||||
|
||||
public static String iso = "en-US";
|
||||
public String iso = "en-US";
|
||||
private static final LangToken tokens = new LangToken();
|
||||
public static final LinkedHashMap<String, String> langMap = new LinkedHashMap<String, String>();
|
||||
private final Quests plugin;
|
||||
|
@ -16,6 +16,7 @@ npc-effects:
|
||||
redo-quest: angry_villager
|
||||
show-requirements: true
|
||||
show-titles: true
|
||||
translate-subcommands: false
|
||||
use-compass: true
|
||||
quester-blacklist:
|
||||
- UUID
|
||||
|
@ -1,57 +1,57 @@
|
||||
COMMAND_LIST: "list"
|
||||
COMMAND_LIST_HELP: "list [page] - List available Quests"
|
||||
COMMAND_LIST_HELP: "<command> [page] - List available Quests"
|
||||
COMMAND_TAKE: "take"
|
||||
COMMAND_TAKE_HELP: "take [quest name] - Accept a Quest"
|
||||
COMMAND_TAKE_USAGE: 'Usage: /quests take [quest]'
|
||||
COMMAND_TAKE_HELP: "<command> [quest] - Accept a Quest"
|
||||
COMMAND_TAKE_USAGE: "Usage: /quests take [quest]"
|
||||
COMMAND_QUIT: "quit"
|
||||
COMMAND_QUIT_HELP: "quit [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_QUIT_HELP: "<command> [quest] - Quit a current Quest"
|
||||
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_QUESTINFO_HELP: "[quest name] - Display Quest information"
|
||||
COMMAND_QUESTINFO_HELP: "[quest] - Display Quest information"
|
||||
COMMAND_QUESTADMIN_HELP: "- View Questadmin help"
|
||||
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_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_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_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_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_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_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_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_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_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_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_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_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_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_HELP: "reload - Reload all Quests"
|
||||
COMMAND_QUESTADMIN_RELOAD_HELP: "<command> - Reload all Quests"
|
||||
questEditorHeader: "Create Quest"
|
||||
questEditorCreate: "Create new Quest"
|
||||
questEditorEdit: "Edit a Quest"
|
||||
|
Loading…
Reference in New Issue
Block a user