Configuration

How to create a custom configuration

With RocketAPI you can create a custom configuration.

Create a class, extends it to Configuration and create a constructor.

public class ExampleConfig extends Configuration {
public ExampleConfig(String fileName, JavaPlugin plugin) {
super(fileName, plugin);
}
}

Now save the example.yml in the jar

Maven example

Save the configuration in your main class

Configuration configuration = new ExampleConfig("example", this);

Okay, you've created your example.yml in your plugin folder!

Now you can get a string from the config with

// Get the string as an Object
configuration.get("example");
// Get the string as a String
configuration.getConfig().getString("example");

Remember to create the example field in your config!

Main class
ExampleConfig class