Skip to content

Using BetterYaml

Dieter Nuytemans edited this page Jun 14, 2021 · 1 revision

BetterYaml

First, make sure your project meets the setup requirements described in the setup wiki page.

Next, consider using OptionalBetterYaml, this is an improvement upon BetterYaml as it does not require you to catch exceptions. BetterYaml is meant for internal use only but remains public to not break projects that are updating. Note that the BetterYaml is deprecated but will not be removed (it serves as motivation to switch to OptionalBetterYaml).

When using the BetterYaml class to handle our files: An IOException is thrown when your setup contains errors. We are assuming that javaPlugin is an instance of your class that extends JavaPlugin. In an instance of that class, you can also pass this instead.

// Auto-updates the config on the server and loads a YamlConfiguration and File
BetterYaml ourConfig = new BetterYaml("ourConfig.yml", javaPlugin);

// Get a YamlConfiguration to do your regular config reading
YamlConfiguration yaml = ourConfig.getYamlConfiguration();
// Not enough? You can also get a File instance
File file = ourConfig.getFile();

Wiki navigation

Wiki home

JavaDocs


BetterYaml (config files)

BetterYaml (deprecated, but supported)

Please use OptionalBetterYaml instead.

Setup

How to use BetterYaml

OptionalBetterYaml

Setup

How to use


BetterLang (language files)

Setup

How to use


Validation

Auto-correct faulty configuration values! You can create your own, custom validators.

How to use validators

EXPERIMENTAL: Optional sections

Clone this wiki locally