aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/leonardobishop/quests/Quests.java6
-rw-r--r--src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java2
-rw-r--r--src/main/java/com/leonardobishop/quests/obj/Options.java2
-rw-r--r--src/main/java/com/leonardobishop/quests/obj/misc/QItemStack.java40
-rw-r--r--src/main/resources/config.yml10
5 files changed, 42 insertions, 18 deletions
diff --git a/src/main/java/com/leonardobishop/quests/Quests.java b/src/main/java/com/leonardobishop/quests/Quests.java
index 5272e9ac..9dd39187 100644
--- a/src/main/java/com/leonardobishop/quests/Quests.java
+++ b/src/main/java/com/leonardobishop/quests/Quests.java
@@ -235,9 +235,9 @@ public class Quests extends JavaPlugin {
questsConfigLoader.loadConfig();
- long autocompleteInterval = 12000;
+ long autosaveInterval = 12000;
if (!isBrokenConfig()) {
- autocompleteInterval = this.getConfig().getLong("options.performance-tweaking.quest-autocomplete-interval", 12000);
+ autosaveInterval = this.getConfig().getLong("options.performance-tweaking.quest-autosave-interval", 12000);
}
boolean autosaveTaskCancelled = true;
if (questAutosaveTask != null) {
@@ -253,7 +253,7 @@ public class Quests extends JavaPlugin {
for (QPlayer qPlayer : qPlayerManager.getQPlayers()) {
qPlayer.getQuestProgressFile().saveToDisk(false);
}
- }, autocompleteInterval, autocompleteInterval);
+ }, autosaveInterval, autosaveInterval);
}
boolean queuePollTaskCancelled = true;
diff --git a/src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java b/src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java
index d1921c29..db8281b2 100644
--- a/src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java
+++ b/src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java
@@ -305,10 +305,10 @@ public class QuestsConfigLoader {
List<String> cLoreNormal = config.getStringList(path + ".lore-normal");
List<String> cLoreStarted = config.getStringList(path + ".lore-started");
- String name;
List<String> loreNormal = translateColoursInList(cLoreNormal);
List<String> loreStarted = translateColoursInList(cLoreStarted);
+ String name;
name = ChatColor.translateAlternateColorCodes('&', cName);
ItemStack is = plugin.getItemStack(path, config,
diff --git a/src/main/java/com/leonardobishop/quests/obj/Options.java b/src/main/java/com/leonardobishop/quests/obj/Options.java
index d7543cec..d108d875 100644
--- a/src/main/java/com/leonardobishop/quests/obj/Options.java
+++ b/src/main/java/com/leonardobishop/quests/obj/Options.java
@@ -30,6 +30,8 @@ public enum Options {
QUEST_AUTOSTART("options.quest-autostart"),
QUEST_AUTOTRACK("options.quest-autotrack"),
GLOBAL_TASK_CONFIGURATION_OVERRIDE("options.global-task-configuration-override"),
+ GLOBAL_QUEST_DISPLAY_CONFIGURATION_OVERRIDE("options.global-quest-display-configuration-override"),
+ GLOBAL_QUEST_DISPLAY_LORE_APPEND_NORMAL("global-quest-display.lore.append-normal"),
GLOBAL_QUEST_DISPLAY_LORE_APPEND_NOT_STARTED("global-quest-display.lore.append-not-started"),
GLOBAL_QUEST_DISPLAY_LORE_APPEND_STARTED("global-quest-display.lore.append-started"),
GLOBAL_QUEST_DISPLAY_LORE_APPEND_TRACKED("global-quest-display.lore.append-tracked");
diff --git a/src/main/java/com/leonardobishop/quests/obj/misc/QItemStack.java b/src/main/java/com/leonardobishop/quests/obj/misc/QItemStack.java
index edb1b963..1995fffe 100644
--- a/src/main/java/com/leonardobishop/quests/obj/misc/QItemStack.java
+++ b/src/main/java/com/leonardobishop/quests/obj/misc/QItemStack.java
@@ -24,9 +24,10 @@ public class QItemStack {
private String name;
private List<String> loreNormal;
private List<String> loreStarted;
- private List<String> globalLoreAppendNotStarted;
- private List<String> globalLoreAppendStarted;
- private List<String> globalLoreAppendTracked;
+ private final List<String> globalLoreAppendNormal;
+ private final List<String> globalLoreAppendNotStarted;
+ private final List<String> globalLoreAppendStarted;
+ private final List<String> globalLoreAppendTracked;
private ItemStack startingItemStack;
public QItemStack(Quests plugin, String name, List<String> loreNormal, List<String> loreStarted, ItemStack startingItemStack) {
@@ -36,6 +37,7 @@ public class QItemStack {
this.loreStarted = loreStarted;
this.startingItemStack = startingItemStack;
+ this.globalLoreAppendNormal = Options.color(Options.GLOBAL_QUEST_DISPLAY_LORE_APPEND_NORMAL.getStringListValue());
this.globalLoreAppendNotStarted = Options.color(Options.GLOBAL_QUEST_DISPLAY_LORE_APPEND_NOT_STARTED.getStringListValue());
this.globalLoreAppendStarted = Options.color(Options.GLOBAL_QUEST_DISPLAY_LORE_APPEND_STARTED.getStringListValue());
this.globalLoreAppendTracked = Options.color(Options.GLOBAL_QUEST_DISPLAY_LORE_APPEND_TRACKED.getStringListValue());
@@ -79,11 +81,32 @@ public class QItemStack {
ItemMeta ism = is.getItemMeta();
ism.setDisplayName(name);
List<String> formattedLore = new ArrayList<>();
- List<String> tempLore = new ArrayList<>(loreNormal);
+ List<String> tempLore = new ArrayList<>();
+
+ if (Options.GLOBAL_QUEST_DISPLAY_CONFIGURATION_OVERRIDE.getBooleanValue() && !globalLoreAppendNormal.isEmpty()) {
+ tempLore.addAll(globalLoreAppendNormal);
+ } else {
+ tempLore.addAll(loreNormal);
+ tempLore.addAll(globalLoreAppendNormal);
+ }
Player player = Bukkit.getPlayer(questProgressFile.getPlayerUUID());
if (questProgressFile.hasStartedQuest(quest)) {
- tempLore.addAll(loreStarted);
+ boolean tracked = quest.getId().equals(questProgressFile.getPlayerPreferences().getTrackedQuestId());
+ if (Options.GLOBAL_QUEST_DISPLAY_CONFIGURATION_OVERRIDE.getBooleanValue() && !globalLoreAppendStarted.isEmpty()) {
+ if (tracked) {
+ tempLore.addAll(globalLoreAppendTracked);
+ } else {
+ tempLore.addAll(globalLoreAppendStarted);
+ }
+ } else {
+ tempLore.addAll(loreStarted);
+ if (tracked) {
+ tempLore.addAll(globalLoreAppendTracked);
+ } else {
+ tempLore.addAll(globalLoreAppendStarted);
+ }
+ }
ism.addEnchant(Enchantment.ARROW_INFINITE, 1, true);
try {
ism.addItemFlags(ItemFlag.HIDE_ENCHANTS);
@@ -91,13 +114,8 @@ public class QItemStack {
} catch (Exception ignored) {
}
- if (quest.getId().equals(questProgressFile.getPlayerPreferences().getTrackedQuestId())) {
- if (globalLoreAppendTracked != null) tempLore.addAll(globalLoreAppendTracked);
- } else {
- if (globalLoreAppendStarted != null) tempLore.addAll(globalLoreAppendStarted);
- }
} else {
- if (globalLoreAppendNotStarted != null) tempLore.addAll(globalLoreAppendNotStarted);
+ tempLore.addAll(globalLoreAppendNotStarted);
}
if (plugin.getPlaceholderAPIHook() != null && Options.GUI_USE_PLACEHOLDERAPI.getBooleanValue()) {
ism.setDisplayName(plugin.getPlaceholderAPIHook().replacePlaceholders(player, ism.getDisplayName()));
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 59129eb8..9145c44b 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -139,7 +139,7 @@ options:
gui-hide-locked: false
# Allow players to cancel a quest (you may want to remove the cancel instructions in the global item lore)
allow-quest-cancel: true
- # Allow players to track a quest
+ # Allow players to track a quest (you may want to remove the tracking instructions in the global item lore)
allow-quest-track: true
# Titles for the GUIs
guinames:
@@ -168,7 +168,7 @@ options:
# The above, but overwriting the file on disk with the cleaned version, so it does not soft clean on every join.
push-soft-clean-to-disk: false
performance-tweaking: # The following are measured in server ticks, multiply SECONDS by 20 to get the number of ticks.
- quest-queue-executor-interval: 1 # how frequently Quests should execute the next check in the completion queue (def=1 - 0.05s) - increase this value if you are struggling with performance
+ quest-queue-executor-interval: 1 # how frequently Quests should execute the next check in the completion queue (def=1 - 0.05s) - increase this value if you are struggling with performance
quest-autosave-interval: 12000 # how frequently online players data will be autosaved (def=12000 - 10 minutes)
tab-completion:
enabled: true
@@ -176,10 +176,12 @@ options:
# Allow quests to be loaded if they contain errors
# This may lead to errors in the console!
override-errors: false
- # How many time (in seconds) plugin save placeholders
+ # How much time (in seconds) that plugin will cache placeholders
placeholder-cache-time: 10
# Whether or not the global task configuration will override per-task configuration settings
global-task-configuration-override: false
+ # Whether or not the global display configuration will override per-quest display settins
+ global-quest-display-configuration-override: false
# This switches up the entire quest system.
# By enabling daily-quests, players will no longer be presented with the standard Quest GUI.
@@ -208,6 +210,8 @@ daily-quests:
global-quest-display:
lore:
+# append-normal:
+# - "..."
append-not-started:
- ""
- "&eLeft Click &7to start this quest."