diff options
Diffstat (limited to 'common/src/main/java/com')
11 files changed, 101 insertions, 2 deletions
diff --git a/common/src/main/java/com/leonardobishop/quests/common/config/QuestsConfig.java b/common/src/main/java/com/leonardobishop/quests/common/config/QuestsConfig.java index be93ed83..29b9f5f1 100644 --- a/common/src/main/java/com/leonardobishop/quests/common/config/QuestsConfig.java +++ b/common/src/main/java/com/leonardobishop/quests/common/config/QuestsConfig.java @@ -2,6 +2,9 @@ package com.leonardobishop.quests.common.config; import java.util.List; +/** + * The quests config stores configuration values for the plugin. + */ public interface QuestsConfig { boolean loadConfig(); diff --git a/common/src/main/java/com/leonardobishop/quests/common/logger/QuestsLogger.java b/common/src/main/java/com/leonardobishop/quests/common/logger/QuestsLogger.java index b4a192cf..e071bc8c 100644 --- a/common/src/main/java/com/leonardobishop/quests/common/logger/QuestsLogger.java +++ b/common/src/main/java/com/leonardobishop/quests/common/logger/QuestsLogger.java @@ -1,5 +1,9 @@ package com.leonardobishop.quests.common.logger; +/** + * The quests logger allows for user customisation of what gets logged. + * Implementations of QuestsLogger should wrap the logger of that platform. + */ public interface QuestsLogger { LoggingLevel getServerLoggingLevel(); diff --git a/common/src/main/java/com/leonardobishop/quests/common/player/QPlayerManager.java b/common/src/main/java/com/leonardobishop/quests/common/player/QPlayerManager.java index 28a46ae1..d24102f4 100644 --- a/common/src/main/java/com/leonardobishop/quests/common/player/QPlayerManager.java +++ b/common/src/main/java/com/leonardobishop/quests/common/player/QPlayerManager.java @@ -11,6 +11,10 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; +/** + * The QPlayerManager is responsible for keeping a reference to all players on the server and is used to + * obtain an instance of a player, load new players and save current players. + */ public class QPlayerManager { private final Map<UUID, QPlayer> qPlayers = new ConcurrentHashMap<>(); diff --git a/common/src/main/java/com/leonardobishop/quests/common/plugin/Quests.java b/common/src/main/java/com/leonardobishop/quests/common/plugin/Quests.java index f6eb67c5..feca2f3f 100644 --- a/common/src/main/java/com/leonardobishop/quests/common/plugin/Quests.java +++ b/common/src/main/java/com/leonardobishop/quests/common/plugin/Quests.java @@ -13,26 +13,89 @@ import com.leonardobishop.quests.common.config.QuestsConfig; public interface Quests { + /** + * Obtain an instance of the Quests logger. + * + * @see QuestsLogger + * @return quests logger + */ QuestsLogger getQuestsLogger(); + /** + * Obtain an instance of the QuestManager. + * + * @see QuestManager + * @return quest manager + */ QuestManager getQuestManager(); + /** + * Obtain an instance of the QPlayerManager. + * + * @see QPlayerManager + * @return quest player manager + */ QPlayerManager getPlayerManager(); + /** + * Obtain an instance of the QuestController. + * + * @see QuestController + * @return quest controller + */ QuestController getQuestController(); + /** + * Obtain an instance of the TaskTypeManager. + * + * @see TaskTypeManager + * @return task type manager + */ TaskTypeManager getTaskTypeManager(); + /** + * Obtain an instance of the QuestCompleter. + * + * @see QuestCompleter + * @return quest completer + */ QuestCompleter getQuestCompleter(); + /** + * Obtain an instance of the QuestConfig. + * + * @see QuestsConfig + * @return quest config + */ QuestsConfig getQuestsConfig(); + /** + * Obtain an instance of the Updater. + * + * @see Updater + * @return updater + */ Updater getUpdater(); + /** + * Obtain an instance of the ServerScheduler. + * + * @see ServerScheduler + * @return server scheduler + */ ServerScheduler getScheduler(); + /** + * Obtain an instance of the StorageProvider. + * + * @see StorageProvider + * @return storage provider + */ StorageProvider getStorageProvider(); + /** + * Performs a full reload of the plugin, unloading and re-registering quests to their task types. + */ void reloadQuests(); } diff --git a/common/src/main/java/com/leonardobishop/quests/common/quest/QuestCompleter.java b/common/src/main/java/com/leonardobishop/quests/common/quest/QuestCompleter.java index db9cd36c..cc498df9 100644 --- a/common/src/main/java/com/leonardobishop/quests/common/quest/QuestCompleter.java +++ b/common/src/main/java/com/leonardobishop/quests/common/quest/QuestCompleter.java @@ -3,6 +3,10 @@ package com.leonardobishop.quests.common.quest; import com.leonardobishop.quests.common.player.questprogressfile.QuestProgress; import com.leonardobishop.quests.common.player.questprogressfile.QuestProgressFile; +/** + * The quest completer is responsible for checking each player for completed quests. Implementations may split + * this workload up into a queue based system. + */ public interface QuestCompleter { void queueSingular(QuestProgress questProgress); diff --git a/common/src/main/java/com/leonardobishop/quests/common/quest/QuestManager.java b/common/src/main/java/com/leonardobishop/quests/common/quest/QuestManager.java index ebace123..af2afa52 100644 --- a/common/src/main/java/com/leonardobishop/quests/common/quest/QuestManager.java +++ b/common/src/main/java/com/leonardobishop/quests/common/quest/QuestManager.java @@ -7,6 +7,9 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +/** + * The quests manager stores all present Quests and Categories on the server and is used as a registry. + */ public class QuestManager { private final Quests plugin; diff --git a/common/src/main/java/com/leonardobishop/quests/common/questcontroller/QuestController.java b/common/src/main/java/com/leonardobishop/quests/common/questcontroller/QuestController.java index 0f5b6e8f..14aa03fd 100644 --- a/common/src/main/java/com/leonardobishop/quests/common/questcontroller/QuestController.java +++ b/common/src/main/java/com/leonardobishop/quests/common/questcontroller/QuestController.java @@ -4,6 +4,10 @@ import com.leonardobishop.quests.common.enums.QuestStartResult; import com.leonardobishop.quests.common.player.QPlayer; import com.leonardobishop.quests.common.quest.Quest; +/** + * The quests controller dictates how the plugin should act and acts as a bridge between a player + * and their progress file, interpreting the progress file and mutating it on certain events. + */ public interface QuestController { String getName(); diff --git a/common/src/main/java/com/leonardobishop/quests/common/scheduler/ServerScheduler.java b/common/src/main/java/com/leonardobishop/quests/common/scheduler/ServerScheduler.java index 0de30f51..b025d809 100644 --- a/common/src/main/java/com/leonardobishop/quests/common/scheduler/ServerScheduler.java +++ b/common/src/main/java/com/leonardobishop/quests/common/scheduler/ServerScheduler.java @@ -1,5 +1,8 @@ package com.leonardobishop.quests.common.scheduler; +/** + * The server scheduler wraps the platforms scheduler to allow for use in abstract code. + */ public interface ServerScheduler { void doSync(Runnable runnable); diff --git a/common/src/main/java/com/leonardobishop/quests/common/storage/StorageProvider.java b/common/src/main/java/com/leonardobishop/quests/common/storage/StorageProvider.java index 4ea885be..26cca4be 100644 --- a/common/src/main/java/com/leonardobishop/quests/common/storage/StorageProvider.java +++ b/common/src/main/java/com/leonardobishop/quests/common/storage/StorageProvider.java @@ -4,6 +4,10 @@ import com.leonardobishop.quests.common.player.questprogressfile.QuestProgressFi import java.util.UUID; +/** + * The storage provider is responsible for obtaining a QuestProgressFile for a specified UUID and for + * writing a QuestProgressFile. + */ public interface StorageProvider { void init(); diff --git a/common/src/main/java/com/leonardobishop/quests/common/tasktype/TaskTypeManager.java b/common/src/main/java/com/leonardobishop/quests/common/tasktype/TaskTypeManager.java index dfa5124e..284a1e0a 100644 --- a/common/src/main/java/com/leonardobishop/quests/common/tasktype/TaskTypeManager.java +++ b/common/src/main/java/com/leonardobishop/quests/common/tasktype/TaskTypeManager.java @@ -6,8 +6,14 @@ import com.leonardobishop.quests.common.quest.Task; import java.util.ArrayList; +/** + * The task type manager stores all registered task types and registers individual quests to each task type. + * Task types can only be registered if registrations are enabled, which is typically only during start-up. + * This is to ensure quests are only registered to task types when all task types have been registered first. + */ public abstract class TaskTypeManager { + private final ArrayList<TaskType> taskTypes = new ArrayList<>(); private final Quests plugin; private boolean allowRegistrations; @@ -24,8 +30,6 @@ public abstract class TaskTypeManager { return allowRegistrations; } - private ArrayList<TaskType> taskTypes = new ArrayList<>(); - public ArrayList<TaskType> getTaskTypes() { return taskTypes; } diff --git a/common/src/main/java/com/leonardobishop/quests/common/updater/Updater.java b/common/src/main/java/com/leonardobishop/quests/common/updater/Updater.java index 70660735..0bc8bd94 100644 --- a/common/src/main/java/com/leonardobishop/quests/common/updater/Updater.java +++ b/common/src/main/java/com/leonardobishop/quests/common/updater/Updater.java @@ -10,6 +10,9 @@ import java.net.URL; import java.net.URLConnection; import java.util.concurrent.TimeUnit; +/** + * The updater checks for updates on Spigot, and prints to the logger if one is found. + */ public class Updater { private static final int PROJECT_ID = 23696; |
