How hi-polarbear/officialauthentication works
OfficialAuthentication is a dual-mode Minecraft plugin that lets an online-mode AUTH server bind authenticated UUIDs to current names in MySQL, while an offline-mode MAIN server looks up names and exposes premium/offline identity through PlaceholderAPI and optional name prefixes. The README documents the main write/read workflow, rename history, admin commands, /zb messages, and configurable bind notifications. Sampled source confirms cache-to-repository lookup, repository persistence, PAPI formatting, and prefix behavior; other event and command wiring is inferred only where documented, so uncertain direct call links are omitted.
Main entry points: AuthService.java Lookup service · AuthRepository.java Identity repository · PlayerListener.java Player events · OfficialAuthExpansion.java PAPI expansion
Components 19
Identity binding
- Player events
src/main/java/com/mention/officialAuthentication/listener/PlayerListener.java - Identity repository
src/main/java/com/mention/officialAuthentication/db/AuthRepository.java - Bind notification
src/main/java/com/mention/officialAuthentication/listener/PlayerListener.java
Main recognition
- Lookup service
src/main/java/com/mention/officialAuthentication/cache/AuthService.java - TTL cache
src/main/java/com/mention/officialAuthentication/cache/AuthCache.java - Auth result
src/main/java/com/mention/officialAuthentication/model/AuthResult.java
Player presentation
- PAPI expansion
src/main/java/com/mention/officialAuthentication/papi/OfficialAuthExpansion.java - Placeholder formatting
src/main/java/com/mention/officialAuthentication/util/PlaceholderValues.java - Name prefixes
src/main/java/com/mention/officialAuthentication/feature/NamePrefixService.java - Status messages
src/main/java/com/mention/officialAuthentication/command/ZbCommand.java
Plugin operations
- Plugin lifecycle
src/main/java/com/mention/officialAuthentication/OfficialAuthentication.java - Mode config
src/main/java/com/mention/officialAuthentication/config/AuthConfig.java - Database manager
src/main/java/com/mention/officialAuthentication/db/DatabaseManager.java - Admin commands
src/main/java/com/mention/officialAuthentication/command/OfficialAuthCommand.java
Other components
- Player
- AUTH server
- MAIN server
- MySQL
- PAPI consumers
Connections 26
- Player → AUTH server: logs into
- AUTH server → Player events: dispatches join
- Player events → Identity repository: binds identity
- Identity repository → MySQL: writes identity history
- MySQL → Identity repository: returns records
- Player events → Bind notification: triggers notice
- Bind notification → Player: shows bind result
- Player → MAIN server: logs into
- MAIN server → Player events: dispatches login
- Player events → Lookup service: requests lookup
- Lookup service → TTL cache: checks or stores
- Lookup service → Identity repository: looks up name
- Identity repository → MySQL: reads identity
- MySQL → Identity repository: returns identity
- Lookup service → Auth result: produces status
- PAPI expansion → Lookup service: resolves name
- PAPI expansion → Placeholder formatting: formats result
- PAPI consumers → PAPI expansion: requests placeholders
- Name prefixes → Lookup service: resolves status
- Name prefixes → PAPI consumers: sets name prefix
- Status messages → Lookup service: checks status
- Admin commands → Identity repository: queries or unlinks
- Admin commands → MySQL: cleans history
- Plugin lifecycle → Database manager: initializes storage
- Plugin lifecycle → PAPI expansion: registers expansion
- Plugin lifecycle → Mode config: loads settings