c1b414f400
CRCore bootstrap class: one-line setup for game plugins (new CRCore(this).enable()).
Wires SQLite, services with event firing, and the /core command tree.
SQLite layer (fr.luc.crcore.database): Database wrapper exposing execute/update/
queryOne/query plus a fluent TableBuilder. ColumnType enum, RowMapper interface,
DatabaseException. Game plugins create their own tables in 2 lines via
db.table("foo").ifNotExists().column(...).create().
Repositories: SqliteTeamRepository and SqlitePlayerProfileRepository extend their
InMemory counterparts (write-through cache). 5 internal tables prefixed crcore_.
Command framework refactored for nested sub-commands: subcommand storage moved
from BaseCommand to AbstractCommand, recursive dispatch() and tabComplete(),
replaceSubCommand() for plugin overrides.
Default /core team commands (13 leaf sub-commands): create, delete, add, remove,
join, leave, info, list, transfer, visibility, score, top, setspawn. Each in its
own class under fr.luc.crcore.command.builtin.team, fully substitutable.
Bukkit events: 9 team events (Create/Dissolve/MemberAdd/MemberRemove/PlayerJoin/
LeadershipTransfer/VisibilityChange/ScoreChange/SpawnPointChange) + 3 player
events (ProfileCreate/Delete/ScoreChange). All post-only, non-cancellable.
BukkitEventFiringTeamServiceImpl and BukkitEventFiringPlayerProfileServiceImpl
override the on* hooks to call Bukkit.getPluginManager().callEvent.
JavaDoc on all new public classes and key existing ones. docs/, GEMINI.md and
PUML diagrams synced: new sections (built-in commands, events, database,
bootstrap), 4 new diagrams (builtin-commands, events, database, bootstrap-
sequence), and 7 new architecture decisions logged.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
63 lines
1.9 KiB
Plaintext
63 lines
1.9 KiB
Plaintext
@startuml bootstrap-sequence
|
|
title CR-Core — Bootstrap from a game plugin (onEnable)
|
|
|
|
participant "MyGamePlugin\nextends JavaPlugin" as Plugin
|
|
participant "CRCore" as Core
|
|
participant "Database" as DB
|
|
participant "SqliteTeamRepository" as TeamRepo
|
|
participant "SqlitePlayerProfileRepository" as PlayerRepo
|
|
participant "BukkitEventFiringTeamServiceImpl" as TeamSvc
|
|
participant "BukkitEventFiringPlayerProfileServiceImpl" as PlayerSvc
|
|
participant "CoreCommand\n(/core)" as Cmd
|
|
participant "Bukkit" as Bukkit
|
|
|
|
Plugin -> Core : new CRCore(this)
|
|
activate Core
|
|
|
|
Plugin -> Core : enable()
|
|
|
|
Core -> DB : new Database(<dataFolder>/crcore.db)
|
|
activate DB
|
|
DB -> DB : ensure parent dir + PRAGMA foreign_keys
|
|
DB --> Core
|
|
deactivate DB
|
|
|
|
Core -> TeamRepo : new SqliteTeamRepository(db)
|
|
activate TeamRepo
|
|
TeamRepo -> DB : ensureSchema() — crcore_teams + crcore_team_members + crcore_team_scores
|
|
TeamRepo -> DB : loadAll() — SELECT pour ré-hydrater le cache mémoire
|
|
TeamRepo --> Core
|
|
deactivate TeamRepo
|
|
|
|
Core -> PlayerRepo : new SqlitePlayerProfileRepository(db)
|
|
activate PlayerRepo
|
|
PlayerRepo -> DB : ensureSchema() — crcore_player_profiles + crcore_player_scores
|
|
PlayerRepo -> DB : loadAll()
|
|
PlayerRepo --> Core
|
|
deactivate PlayerRepo
|
|
|
|
Core -> TeamSvc : buildTeamService(teamRepo)
|
|
Core -> PlayerSvc : buildPlayerProfileService(playerRepo)
|
|
|
|
Core -> Cmd : new CoreCommand(teamSvc, playerSvc)
|
|
activate Cmd
|
|
Cmd -> Cmd : registerDefaults() — TeamGroupSubCommand avec 13 leaf sub-cmds
|
|
Cmd --> Core
|
|
deactivate Cmd
|
|
|
|
Core -> Bukkit : plugin.getCommand("core").setExecutor(cmd)
|
|
Core -> Bukkit : .setTabCompleter(cmd)
|
|
|
|
Core --> Plugin : this (chainable)
|
|
deactivate Core
|
|
|
|
note over Plugin
|
|
À ce stade :
|
|
- /core team create/delete/add/... fonctionnel
|
|
- SQLite persiste team + player + leurs scores
|
|
- Évènements Bukkit sont tirés sur chaque opération
|
|
- Le plugin de jeu peut listen avec @EventHandler
|
|
end note
|
|
|
|
@enduml
|