1. Keep Addon IDs in a Constants File
Hard-coding magic numbers across multiple addons leads to collisions and makes refactors error-prone. Maintain a single constants class that every addon and Spigot plugin references.2. Use UUIDs as ID Fields
Player display names, guild tags, and world names can change over time. If you use a mutable value as theisId field, you risk creating duplicate MongoDB documents and stale cache entries. Always prefer a stable, immutable identifier.
3. Keep handleRequest() Fast
handleRequest() runs synchronously on the inbound packet-processing thread before any Redis or MongoDB I/O. Blocking here delays every request targeting this addon. Perform only lightweight validation: source checks, field presence tests, and enum comparisons.
handleRequest().
4. Use Distinctive cacheKeyHeaderTag Values
The Redis cache key format is {cacheKeyHeaderTag()}_{idFieldValue}. Two addons sharing the same prefix will overwrite each other’s cache entries and silently serve incorrect data.
5. Never Call MongoDB Directly from Spigot Plugins
The entire purpose of Nexus Core is centralized data access. Bypassing it by connecting a Spigot plugin directly to MongoDB breaks cache consistency, introduces a second connection pool, and duplicates data logic. Always route operations through Redis packets.6. Always Define NEXUS_SIGNING_KEY in Production
When NEXUS_SIGNING_KEY is not configured, signature verification is disabled. Your network becomes vulnerable to forged and replayed packets. Set a strong, unique key before deploying and never hardcode it in source files or version control.
Related Topics
- Security — how HMAC signing, timestamp validation, and nonce protection work
- DataAddon API — the full abstract method reference
- Annotations —
@DbDataModelssyntax and supported types