Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.
RedMagic edited this page May 24, 2024 · 2 revisions

We have made it a bit easlier to create, load and save files. In the currenlt version we only have two types JSON and YAML.

YAML

Load

To create a yaml you will need to create a new instance of UndefinedYAML. (See below)

val customYAML = UndefinedYAML("config.yml", true)

The first parameter is the file path. This can be a File, Path or a String. The second parameter is a boolean default is false. If you put this on true it will try and find the file in your resources folder in your plugin and copys it from there.

Edit

To be able to edit the data inside the YAML you can use the instance of the UndefinedYAML and get the configuration this will return a YamlConfiguration then you can use all the method there like any YAML file. (See below)

customYAML.configuration.getString("nice")

Saving

Saving is not much differnt you get a instance of the UndefinedYAML then you use the save method. (See below)

customYAML.save()

JSON

Load

Using a JSON is the same as a YAML file but instead of using a UndefinedYAML you can UndefinedJSON. (See below)

val customJSON = UndefinedJSON("customJson.json")

Edit

Editing a Custom JSON is the same as YAML but instead of a YamlConfiguration or get JSONObect. (See below)

customJSON.configuration.getJSONArray("array")

Save

Saving it is the same as YAMl nothing different. (See below)

customJSON.save()
Clone this wiki locally