diff options
| -rw-r--r-- | src/config.yml | 10 | ||||
| -rw-r--r-- | src/me/fatpigsarefat/quests/obj/Options.java | 5 | ||||
| -rw-r--r-- | src/me/fatpigsarefat/quests/obj/misc/QMenuCategory.java | 4 | ||||
| -rw-r--r-- | src/me/fatpigsarefat/quests/obj/misc/QMenuDaily.java | 73 | ||||
| -rw-r--r-- | src/me/fatpigsarefat/quests/obj/misc/QMenuQuest.java | 6 |
5 files changed, 56 insertions, 42 deletions
diff --git a/src/config.yml b/src/config.yml index ca64aeaa..65aaea2e 100644 --- a/src/config.yml +++ b/src/config.yml @@ -771,9 +771,15 @@ options: categories-enabled: true # If true, the gui size will automatically change based on the amount of quests inside it. trim-gui-size: true + # Enable/disable titles titles-enabled: true # Players cannot start any more quests than this at a single time quest-started-limit: 2 + # Titles for the GUIs + guinames: + quests-category: "Quests Categories" + quests-menu : "Quests" + daily-quests: "Daily Quests" # This switches up the entire quest system. # By enabling daily-quests, players will no longer be presented with the standard Quest GUI. @@ -783,9 +789,12 @@ options: # The 'repeatable' section in each quest does not apply here. It will NOT be repeatable until the next day. # Enabling this MAY cause previous quest progress to be modified, wiped or changed irreversibly! If you're testing this on a live server, it is wise to backup # the Quests/playerdata/ folder! You've been warned! +# +# Quests BETA: this feature is a work in progress, it does not work yet! daily-quests: enabled: false +# Configure titles titles: quest-start: title: "&cQuest Started" @@ -794,6 +803,7 @@ titles: title: "&cQuest Complete" subtitle: "&7{quest}" +# Configure messages messages: quest-start: "&7Quest &c{quest} &7started!" quest-complete: "&7Quest &c{quest} &7completed!" diff --git a/src/me/fatpigsarefat/quests/obj/Options.java b/src/me/fatpigsarefat/quests/obj/Options.java index d4b63499..d29d3966 100644 --- a/src/me/fatpigsarefat/quests/obj/Options.java +++ b/src/me/fatpigsarefat/quests/obj/Options.java @@ -11,7 +11,10 @@ public enum Options { CATEGORIES_ENABLED("options.categories-enabled"), TRIM_GUI_SIZE("options.trim-gui-size"), QUESTS_START_LIMIT("options.quest-started-limit"), - TITLES_ENABLED("options.titles-enabled"); + TITLES_ENABLED("options.titles-enabled"), + GUITITLE_QUESTS_CATEGORY("options.guinames.quests-category"), + GUITITLE_QUESTS("options.guinames.quests"), + GUITITLE_DAILY_QUESTS("options.guinames.daily-quests"); private String path; diff --git a/src/me/fatpigsarefat/quests/obj/misc/QMenuCategory.java b/src/me/fatpigsarefat/quests/obj/misc/QMenuCategory.java index 449f81d6..61d1ac57 100644 --- a/src/me/fatpigsarefat/quests/obj/misc/QMenuCategory.java +++ b/src/me/fatpigsarefat/quests/obj/misc/QMenuCategory.java @@ -43,11 +43,11 @@ public class QMenuCategory implements QMenu { public Inventory toInventory(int page) { int pageMin = pageSize * (page - 1); int pageMax = pageSize * page; - String title = "Quest Categories"; + String title = Options.GUITITLE_QUESTS_CATEGORY.getStringValue(); ItemStack pageIs = new ItemStack(Material.DIRT); - Inventory inventory = Bukkit.createInventory(null, 54, title); //TODO make configurable title + Inventory inventory = Bukkit.createInventory(null, 54, title); for (int pointer = pageMin; pointer < pageMax; pointer++) { if (slotsToMenuQuest.containsKey(pointer)) { diff --git a/src/me/fatpigsarefat/quests/obj/misc/QMenuDaily.java b/src/me/fatpigsarefat/quests/obj/misc/QMenuDaily.java index c731a2dd..9b50f7ee 100644 --- a/src/me/fatpigsarefat/quests/obj/misc/QMenuDaily.java +++ b/src/me/fatpigsarefat/quests/obj/misc/QMenuDaily.java @@ -2,6 +2,7 @@ package me.fatpigsarefat.quests.obj.misc; import me.fatpigsarefat.quests.Quests; import me.fatpigsarefat.quests.obj.Items; +import me.fatpigsarefat.quests.obj.Options; import me.fatpigsarefat.quests.player.QPlayer; import me.fatpigsarefat.quests.player.questprogressfile.QuestProgress; import me.fatpigsarefat.quests.quests.Quest; @@ -59,43 +60,45 @@ public class QMenuDaily implements QMenu { public Inventory toInventory(int page) { int pageMin = pageSize * (page - 1); int pageMax = pageSize * page; - String title = "Daily Quests"; + String title = Options.GUITITLE_DAILY_QUESTS.toString(); - Inventory inventory = Bukkit.createInventory(null, 27, title); //TODO make configurable title + Inventory inventory = Bukkit.createInventory(null, 27, title); - int invSlot = 11; - for (int pointer = pageMin; pointer < pageMax; pointer++) { - if (slotsToQuestIds.containsKey(pointer)) { - Quest quest = Quests.getQuestManager().getQuestById(slotsToQuestIds.get(pointer)); - QuestProgress questProgress = owner.getQuestProgressFile().getQuestProgress(quest); - long cooldown = owner.getQuestProgressFile().getCooldownFor(quest); - if (!owner.getQuestProgressFile().hasMetRequirements(quest)) { - List<String> quests = new ArrayList<>(); - for (String requirement : quest.getRequirements()) { - quests.add(Quests.getQuestManager().getQuestById(requirement).getDisplayNameStripped()); - } - Map<String, String> placeholders = new HashMap<>(); - placeholders.put("{quest}", quest.getDisplayNameStripped()); - placeholders.put("{requirements}", String.join(", ", quests)); - ItemStack is = replaceItemStack(Items.QUEST_LOCKED.getItem(), placeholders); - inventory.setItem(invSlot, is); - } else if (!quest.isRepeatable() && questProgress.isCompletedBefore()) { - Map<String, String> placeholders = new HashMap<>(); - placeholders.put("{quest}", quest.getDisplayNameStripped()); - ItemStack is = replaceItemStack(Items.QUEST_COMPLETED.getItem(), placeholders); - inventory.setItem(invSlot, is); - } else if (cooldown > 0) { - Map<String, String> placeholders = new HashMap<>(); - placeholders.put("{time}", Quests.convertToFormat(TimeUnit.MINUTES.convert(cooldown, TimeUnit.MILLISECONDS))); - placeholders.put("{quest}", quest.getDisplayNameStripped()); - ItemStack is = replaceItemStack(Items.QUEST_COOLDOWN.getItem(), placeholders); - inventory.setItem(invSlot, is); - } else { - inventory.setItem(invSlot, Quests.getQuestManager().getQuestById(quest.getId()).getDisplayItem().toItemStack(questProgress)); - } - } - invSlot++; - } + //TODO daily quests + +// int invSlot = 11; +// for (int pointer = pageMin; pointer < pageMax; pointer++) { +// if (slotsToQuestIds.containsKey(pointer)) { +// Quest quest = Quests.getQuestManager().getQuestById(slotsToQuestIds.get(pointer)); +// QuestProgress questProgress = owner.getQuestProgressFile().getQuestProgress(quest); +// long cooldown = owner.getQuestProgressFile().getCooldownFor(quest); +// if (!owner.getQuestProgressFile().hasMetRequirements(quest)) { +// List<String> quests = new ArrayList<>(); +// for (String requirement : quest.getRequirements()) { +// quests.add(Quests.getQuestManager().getQuestById(requirement).getDisplayNameStripped()); +// } +// Map<String, String> placeholders = new HashMap<>(); +// placeholders.put("{quest}", quest.getDisplayNameStripped()); +// placeholders.put("{requirements}", String.join(", ", quests)); +// ItemStack is = replaceItemStack(Items.QUEST_LOCKED.getItem(), placeholders); +// inventory.setItem(invSlot, is); +// } else if (!quest.isRepeatable() && questProgress.isCompletedBefore()) { +// Map<String, String> placeholders = new HashMap<>(); +// placeholders.put("{quest}", quest.getDisplayNameStripped()); +// ItemStack is = replaceItemStack(Items.QUEST_COMPLETED.getItem(), placeholders); +// inventory.setItem(invSlot, is); +// } else if (cooldown > 0) { +// Map<String, String> placeholders = new HashMap<>(); +// placeholders.put("{time}", Quests.convertToFormat(TimeUnit.MINUTES.convert(cooldown, TimeUnit.MILLISECONDS))); +// placeholders.put("{quest}", quest.getDisplayNameStripped()); +// ItemStack is = replaceItemStack(Items.QUEST_COOLDOWN.getItem(), placeholders); +// inventory.setItem(invSlot, is); +// } else { +// inventory.setItem(invSlot, Quests.getQuestManager().getQuestById(quest.getId()).getDisplayItem().toItemStack(questProgress)); +// } +// } +// invSlot++; +// } return inventory; } diff --git a/src/me/fatpigsarefat/quests/obj/misc/QMenuQuest.java b/src/me/fatpigsarefat/quests/obj/misc/QMenuQuest.java index 8932159c..7200357e 100644 --- a/src/me/fatpigsarefat/quests/obj/misc/QMenuQuest.java +++ b/src/me/fatpigsarefat/quests/obj/misc/QMenuQuest.java @@ -78,14 +78,14 @@ public class QMenuQuest implements QMenu { currentPage = page; int pageMin = pageSize * (page - 1); int pageMax = pageSize * page; - String title = "Quests"; + String title = Options.GUITITLE_QUESTS.getStringValue(); ItemStack pageIs; ItemStack pagePrevIs; ItemStack pageNextIs; ItemStack back = Items.BACK_BUTTON.getItem(); - Inventory inventory = Bukkit.createInventory(null, 54, title); //TODO make configurable title + Inventory inventory = Bukkit.createInventory(null, 54, title); int invSlot = 0; for (int pointer = pageMin; pointer < pageMax; pointer++) { @@ -178,8 +178,6 @@ public class QMenuQuest implements QMenu { } return inventory; - - //TODO add page controls } public boolean isBackButtonEnabled() { |
