Skip to main content
RefineryConfiguration (xyz.refineryteam.refinerycore.api.config) maps a YAML file directly onto fields of a Java class using annotations, so you don’t hand-write getConfig().getString(...) calls scattered across your plugin.

Defining a configuration class

Extend RefineryConfiguration, annotate the class with @ConfigFile, and annotate fields with @ConfigEntry:
MainConfig.java
The field’s initial value doubles as the default — when the key doesn’t exist in the YAML file yet, that value is written back before the file is saved.

Annotations

Nested sections

Group related entries into a nested object using @ConfigSection:
MainConfig.java
This produces:

Lifecycle

Plugin.java

Supported field types

Primitives and their boxed equivalents (int/Integer, long/Long, double/Double, float/Float, boolean/Boolean), String, List, Map, and nested @ConfigSection types are all handled automatically. Values read back from YAML are cast to the field’s declared type — for example, a YAML integer read into a long field is safely widened.
Lists and maps are read back as new ArrayList/HashMap instances regardless of the YAML value’s concrete implementation. If the value at that path isn’t actually a list/map when read, an empty collection is substituted rather than throwing.

Example: reload command integration

Since reload() can throw (e.g. malformed YAML), pair it with CommandContext#executiveContext from the command framework:
PluginCommand.java