Files
Cites_Plugins/docs/diagrams/database-diagram.puml
T
Antone Barbaud c1b414f400 feat: SQLite persistence, default /core commands, Bukkit events, bootstrap
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>
2026-06-09 10:54:00 +02:00

87 lines
1.9 KiB
Plaintext

@startuml database-diagram
title CR-Core — Database (SQLite wrapper)
skinparam classAttributeIconSize 0
hide empty members
package "fr.luc.crcore.database" {
class Database {
- connection: Connection
+ Database(file: File)
+ execute(sql, params...): void
+ update(sql, params...): int
+ queryOne(sql, mapper, params...): Optional<T>
+ query(sql, mapper, params...): List<T>
+ inTransaction(block: Runnable): void
+ table(name: String): TableBuilder
+ tableExists(name: String): boolean
+ getConnection(): Connection
+ close(): void
}
Database ..|> "java.lang.AutoCloseable"
class TableBuilder {
- database: Database
- name: String
- columns: List<ColumnDef>
- ifNotExists: boolean
+ ifNotExists(): TableBuilder
+ column(name, type): ColumnDef
+ create(): void
}
class "TableBuilder.ColumnDef" as ColumnDef {
- name: String
- type: ColumnType
- primaryKey: boolean
- notNull: boolean
- unique: boolean
- defaultValue: String
+ primaryKey(): ColumnDef
+ notNull(): ColumnDef
+ unique(): ColumnDef
+ defaultValue(expr: String): ColumnDef
+ column(name, type): ColumnDef
+ create(): void
}
enum ColumnType {
INTEGER
REAL
TEXT
BLOB
BOOLEAN
UUID
--
+ getSqlType(): String
}
interface "RowMapper<T>" as RowMapper {
+ map(rs: ResultSet): T
}
class DatabaseException
DatabaseException --|> RuntimeException
Database "1" *-- "*" TableBuilder : creates
TableBuilder "1" *-- "*" ColumnDef : contains
ColumnDef --> ColumnType : type
Database ..> RowMapper : uses
Database ..> DatabaseException : throws
}
note right of Database
Repositories SQLite de CR-Core
(SqliteTeamRepository,
SqlitePlayerProfileRepository)
utilisent Database pour
persister state team/player.
Les plugins de jeu utilisent
Database.table(...) pour
créer leurs tables custom.
end note
@enduml