Using Cupboard as a Mod Developer to Cut Duplicate Code
What the library gives you
If you're writing a mod and considering Cupboard as a dependency, its value is in not reimplementing the boring parts. Cupboard provides frameworks for JSON configuration, player data handling, and client/server synchronization, plus logging utilities. The stated goal is to reduce duplicate code across mods — so instead of every mod rolling its own config parser and sync packets, they share one tested implementation.
Practical steps to adopt it
1. Declare the dependency in your mod's metadata so loaders know Cupboard must be present, and so players get a clear error rather than a crash if it's missing.
2. Move your config to the JSON
framework. Define your settings through Cupboard's config API rather than hand-rolling file I/O. You get consistent file generation and parsing for free.
3. Route player data through Cupboard's handling instead of writing your own persistence. This is where the sync benefit shows up: data you register is kept consistent between client and server without you writing custom packets.
4. Use its logging utilities so your mod's output is formatted consistently and can be filtered alongside other Cupboard-based mods.
Keep it clean
Because Cupboard is a *library*, your mod should still be the thing players configure and interact with — Cupboard stays invisible. Don't expose Cupboard's internal structures directly to players; wrap them in your own config screen or commands. And document which of your settings are Cupboard-backed, so server admins know where the JSON files live when they need to edit them by hand.