The built-in version of MySQL storage does not use connection pooling and closes the connection every time it uses it.
QuestLib will execute the following query to create tables:
CREATETABLEIFNOTEXISTS`running_quests`(`uuid`VARCHAR(36) NOT NULL, `identifier`VARCHAR(45) NOT NULL,`objective_identifier`VARCHAR(45) NOT NULL,`data`JSONNULL,PRIMARY KEY (`uuid`));
Objective data will be stored as Json.
Create your own storage method
If you don't like the built-in storage types, you can always create your own by extending the QuestStorage class. This will require the following methods:
If you've created your own storage method, you can pass it as parameter when initiating QuestLib.
/**
* Create a new quest in the storage.
* @param playerId The UUID of the player to create the quest for.
* @param identifier The identifier of the current quest.
* @param objectiveIdentifier The identifier of the current objective.
* @param data The data that is used by the objective.
*/
void newQuest(UUID playerId, String identifier, String objectiveIdentifier, HashMap<String, Object> data);
/**
* Remove a quest from the storage.
* @param playerId The UUID of the player to remove the stored quest from.
*/
void removeQuest(UUID playerId);
/**
* Update an existing quest in the storage.
* @param playerId The UUID of the player to update the quest for.
* @param identifier The new identifier of the current quest.
* @param objectiveIdentifier The new identifier of the current objective.
* @param data The new data that is used by the new current objective.
*/
void updateQuest(UUID playerId, String identifier, String objectiveIdentifier, HashMap<String, Object> data);
/**
* Check if a player has a quest running/stored.
* @param playerId The UUID of the player to check.
* @return Whether the player has a quest running/stored.
*/
boolean hasQuest(UUID playerId);
/**
* Get all quests stored.
* @return A list of all quests stored in the storage.
*/
List<QuestStorable> getAllQuests();