Storage

Use existing storage method

QuestLib offers different types of built-in storage.

YAML

new YAML(File file);

The file can be any location you want, for example:

YourMainClass.java
File file = new File(this.getDataFolder() + "/data", "data.yml");

The example above will store data inside plugins/YourPlugin/data/data.yml

MySQL

new MySQL(String host, String database, String username, String password, int port) 

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:

CREATE TABLE IF NOT EXISTS `running_quests`(
`uuid` VARCHAR(36) NOT NULL, 
`identifier` VARCHAR(45) NOT NULL,
`objective_identifier` VARCHAR(45) NOT NULL,
`data` JSON NULL,
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.

Last updated

Was this helpful?