xpple / BetterConfig

A very powerful and easy to use command based configuration library for servers and clients.
GNU Lesser General Public License v3.0
7 stars 2 forks source link

Add global change hook #11

Closed xpple closed 1 month ago

xpple commented 1 month ago

Adds support for a global change callback that is called whenever any configuration value is updated. For example:

new ModConfigBuilder<>("<mod id>", Configs.class)
    .registerGlobalChangeHook(event -> LOGGER.info("{} was updated | old: {}, new: {}", event.config(), event.oldValue(), event.newValue()))
    .build();