Update GUI implementation and correct some text, fixes #34

This commit is contained in:
HappyPikachu 2015-03-01 03:35:44 -05:00
parent 72f0416dd9
commit 45e52d8030
4 changed files with 26 additions and 21 deletions

View File

@ -135,10 +135,8 @@ public class NpcListener implements Listener {
LinkedList<Quest> npcQuests = new LinkedList<Quest>();
for (Quest q : plugin.getQuests()) {
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 (q.testRequirements(quester)) {
@ -151,12 +149,11 @@ public class NpcListener implements Listener {
}
if (npcQuests.isEmpty() == false && npcQuests.size() > 1) {
if (npcQuests.isEmpty() == false && npcQuests.size() >= 1) {
if (plugin.questNPCGUIs.contains(evt.getNPC().getId())) {
quester.showGUIDisplay(evt.getNPC(), npcQuests);
return;
}
Conversation c = plugin.NPCConversationFactory.buildConversation((Conversable) player);

View File

@ -175,7 +175,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) {
text += BLUE + "" + BOLD + "3" + RESET + RED + " - " + Lang.get("questEditorFinishMessage") + " " + DARKRED + Lang.get("questRequiredNoneSet") + "\n";
text += BLUE + "" + BOLD + "3" + RESET + RED + " - " + Lang.get("questEditorFinishMessage") + " " + DARKRED + "(" + Lang.get("questRequiredNoneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("questEditorFinishMessage") + " (\"" + context.getSessionData(CK.Q_FINISH_MESSAGE) + "\")\n";
}
@ -1037,6 +1037,13 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
ConfigurationSection newSection = questSection.createSection("custom" + customNum);
saveQuest(context, newSection);
data.save(new File(quests.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);
}
quests.updateData();
}
context.getForWhom().sendRawMessage(BOLD + Lang.get("questEditorSaved"));
} catch (IOException e) {
@ -1277,7 +1284,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
cs.set("finish-message", finish);
cs.set("initial-event", initialEvent);
cs.set("region", region);
cs.set("guiDisplay", ItemUtil.serialize(guiDisplay));
cs.set("gui-display", ItemUtil.serialize(guiDisplay));
if (moneyReq != null || questPointsReq != null || itemReqs != null && itemReqs.isEmpty() == false || permReqs != null && permReqs.isEmpty() == false || (questReqs != null && questReqs.isEmpty() == false) || (questBlocks != null && questBlocks.isEmpty() == false) || (mcMMOSkillReqs != null && mcMMOSkillReqs.isEmpty() == false) || heroesPrimaryReq != null || heroesSecondaryReq != null || customReqs != null) {

View File

@ -1457,7 +1457,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("killMob")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("kill") + mob.name();
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("kill") + " " + mob.name();
message = message + " " + getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(mob)) + "/" + getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(mob));
p.sendMessage(message);
if (testComplete(quest)) {
@ -1485,7 +1485,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("killNPC")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("kill") + npc.getName();
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("kill") + " " + npc.getName();
message = message + " " + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(npc.getId())) + "/" + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(npc.getId()));
p.sendMessage(message);
if (testComplete(quest)) {
@ -1494,7 +1494,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("tameMob")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("tame") + getCapitalized(mob.name());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("tame") + " " + getCapitalized(mob.name());
message = message + " " + getCurrentStage(quest).mobsToTame.get(mob) + "/" + getCurrentStage(quest).mobsToTame.get(mob);
p.sendMessage(message);
if (testComplete(quest)) {

View File

@ -445,7 +445,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
quester.saveData();
}
getLogger().info("Disabled.");
updateData();
}
@ -2459,6 +2459,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
quests.clear();
events.clear();
loadQuests();
loadData();
loadEvents();
loadConfig();
@ -2606,9 +2607,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
if (config.contains("quests." + questName + ".guiDisplay")) {
if (config.contains("quests." + questName + ".gui-display")) {
String item = config.getString("quests." + questName + ".guiDisplay");
String item = config.getString("quests." + questName + ".gui-display");
try {
ItemStack stack = ItemUtil.readItemStack(item);
@ -2616,7 +2617,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!");
instance.getLogger().warning(item + " in items: GUI Display in Quest " + quest.name + "is not properly formatted!");
}
}