CwCommons
Shared library for CrimsonWarpedcraft Bukkit plugins. It bundles the infrastructure that every plugin ends up rewriting — configuration loading, command registration, and persistent data storage — behind small, well-tested APIs so each plugin can focus on its own behaviour.
Features
ConfigManager— loads a YAML file into a plain Java object and validates it with Jakarta Bean Validation. Any POJO that implementsConfigand declares JSR-380 constraints (e.g.@NotBlank,@Min) works — a violation fails fast with a readable message instead of a half-initialised plugin. See Config Loading.BaseCommand— a thin base class that wraps aCommandAPICommandand implements theCommandregistration interface, so every command in every plugin is declared and registered the same way. See Commands.DataStore— an asynchronous, write-behind key-value store split into namespacedRepositoryinstances. Writes are buffered in memory and flushed to disk off the main thread. SQLite is bundled; MongoDB is a drop-in alternative behind the same API. Optional Bukkit helpers cover per-player data, periodic flushing, andLocation/ItemStackserialization. Start with the Data Store guide.
How the pieces fit together
The three packages are independent — use one, two, or all of them:
| Package | Entry point | Guide |
|---|---|---|
config | ConfigManager | Config Loading |
command | BaseCommand | Commands |
store | DataStore | Data Store → Bukkit Integration, MongoDB |
Documentation
- Getting Started — add cw-commons as a dependency.
- Examples — task-focused guides for config, commands, and storage.
- API Reference — full Javadoc for the latest release, hosted by JitPack. Older versions are kept too.