refactor: split team/player/message into impl/ and exception/ subpackages
Each domain now has:
- Top-level package: contracts (interfaces, entities, enums, values, events).
- exception/ subpackage: exception hierarchy.
- impl/ subpackage: implementations CR-Core ships by default, swappable by
a game plugin if needed.
Moved (FQN changes for consumers):
- fr.luc.crcore.team.TeamException (+ AlreadyExists, NotFound, Access)
→ fr.luc.crcore.team.exception.*
- fr.luc.crcore.team.TeamServiceImpl, BukkitEventFiringTeamServiceImpl,
InMemoryTeamRepository, SqliteTeamRepository
→ fr.luc.crcore.team.impl.*
- fr.luc.crcore.player.PlayerException, PlayerProfileNotFoundException
→ fr.luc.crcore.player.exception.*
- fr.luc.crcore.player.PlayerProfileServiceImpl,
BukkitEventFiringPlayerProfileServiceImpl,
InMemoryPlayerProfileRepository, SqlitePlayerProfileRepository
→ fr.luc.crcore.player.impl.*
- fr.luc.crcore.message.YamlMessagesService
→ fr.luc.crcore.message.impl.YamlMessagesService
Unchanged top-level packages: database/, command/, common/ (already small
and well-organized). Events stay where they were (already in event/
subpackages).
setup.md tree updated to reflect the new layout. decisions.md logs the
rationale (consumer-facing FQNs, separation between contract and impl).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -367,6 +367,40 @@ Format léger : une décision = un titre + contexte + choix + raison.
|
||||
bases existantes, ALTER TABLE manuel ou suppression du fichier
|
||||
(les bases d'event sont jetables).
|
||||
|
||||
## 2026-06-09 — Réorganisation packages : `impl/` et `exception/` séparés
|
||||
|
||||
- **Choix** : pour chaque domaine (`team`, `player`, `message`), les
|
||||
implémentations passent dans un sous-package `impl/` et les exceptions dans
|
||||
un sous-package `exception/`. Le top-level du package ne contient plus que
|
||||
les contrats publics (interfaces, entités, enums, values).
|
||||
- **Conséquences sur les FQN publics** (importer côté plugin de jeu si on les
|
||||
utilise) :
|
||||
- `fr.luc.crcore.team.TeamException` → `fr.luc.crcore.team.exception.TeamException`
|
||||
(et ses 3 sous-classes)
|
||||
- `fr.luc.crcore.team.TeamServiceImpl` → `fr.luc.crcore.team.impl.TeamServiceImpl`
|
||||
(idem `BukkitEventFiring*`, `InMemory*Repository`, `Sqlite*Repository`)
|
||||
- `fr.luc.crcore.player.PlayerException` → `fr.luc.crcore.player.exception.PlayerException`
|
||||
(et `PlayerProfileNotFoundException`)
|
||||
- `fr.luc.crcore.player.*Impl` / `*Repository` impl → `fr.luc.crcore.player.impl.*`
|
||||
- `fr.luc.crcore.message.YamlMessagesService` → `fr.luc.crcore.message.impl.YamlMessagesService`
|
||||
- **Inchangés** : tous les enums, entités, interfaces de service et de repo,
|
||||
ranking records, events (qui étaient déjà dans un sous-package
|
||||
{@code event/}).
|
||||
- **Raison** : lisibilité. Un dev qui ouvre `fr.luc.crcore.team/` voit
|
||||
immédiatement les contrats (Team, TeamService, TeamRepository, enums,
|
||||
events) sans se faire noyer par les impls. Pour overrider, il sait où
|
||||
chercher (`impl/`). Pour catch une exception, il sait où chercher
|
||||
(`exception/`).
|
||||
- **Convention top-level vs impl/** :
|
||||
- **Top-level** = ce qu'un consommateur doit connaître pour utiliser ou
|
||||
étendre l'API : interfaces, entités, enums, values, events.
|
||||
- **impl/** = ce que CR-Core fournit par défaut, qu'un game plugin peut
|
||||
swap. C'est aussi là que vivent les sous-classes utilisées en interne
|
||||
par le bootstrap (BukkitEventFiring*ServiceImpl, Sqlite*Repository).
|
||||
- **Pas appliqué à `database/`, `command/` et `common/`** : ces packages
|
||||
sont déjà petits et bien lisibles ; ajouter `impl/` à 3 fichiers serait
|
||||
cosmétique.
|
||||
|
||||
## 2026-06-09 — `MessagesService` : YAML externalisable, un seul fichier par plugin
|
||||
|
||||
- **Choix** : nouveau module `fr.luc.crcore.message` avec une interface
|
||||
|
||||
+52
-44
@@ -211,50 +211,58 @@ CitesPlugin/ # dossier IntelliJ (renommer plus t
|
||||
│ ├── TeamScoreSubCommand.java # /core team score (admin)
|
||||
│ ├── TeamTopSubCommand.java # /core team top
|
||||
│ └── TeamSetSpawnSubCommand.java # /core team setspawn
|
||||
├── team/
|
||||
│ ├── Team.java
|
||||
│ ├── TeamMember.java
|
||||
│ ├── TeamRole.java
|
||||
│ ├── TeamColor.java
|
||||
│ ├── TeamVisibility.java
|
||||
│ ├── TeamRanking.java # record
|
||||
│ ├── TeamRepository.java
|
||||
│ ├── InMemoryTeamRepository.java
|
||||
│ ├── SqliteTeamRepository.java
|
||||
│ ├── TeamService.java
|
||||
│ ├── TeamServiceImpl.java
|
||||
│ ├── BukkitEventFiringTeamServiceImpl.java # impl par défaut
|
||||
│ ├── TeamException.java
|
||||
│ ├── TeamAlreadyExistsException.java
|
||||
│ ├── TeamNotFoundException.java
|
||||
│ ├── TeamAccessException.java
|
||||
│ └── event/ # Bukkit events team
|
||||
│ ├── TeamEvent.java # base
|
||||
│ ├── TeamCreateEvent.java
|
||||
│ ├── TeamDissolveEvent.java
|
||||
│ ├── TeamMemberAddEvent.java
|
||||
│ ├── TeamMemberRemoveEvent.java
|
||||
│ ├── PlayerJoinTeamEvent.java
|
||||
│ ├── TeamLeadershipTransferEvent.java
|
||||
│ ├── TeamVisibilityChangeEvent.java
|
||||
│ ├── TeamScoreChangeEvent.java
|
||||
│ └── TeamSpawnPointChangeEvent.java
|
||||
└── player/
|
||||
├── PlayerProfile.java
|
||||
├── PlayerRanking.java
|
||||
├── PlayerProfileRepository.java
|
||||
├── InMemoryPlayerProfileRepository.java
|
||||
├── SqlitePlayerProfileRepository.java
|
||||
├── PlayerProfileService.java
|
||||
├── PlayerProfileServiceImpl.java
|
||||
├── BukkitEventFiringPlayerProfileServiceImpl.java
|
||||
├── PlayerException.java
|
||||
├── PlayerProfileNotFoundException.java
|
||||
└── event/ # Bukkit events player
|
||||
├── PlayerProfileEvent.java
|
||||
├── PlayerProfileCreateEvent.java
|
||||
├── PlayerProfileDeleteEvent.java
|
||||
└── PlayerScoreChangeEvent.java
|
||||
├── message/ # service de messages YAML
|
||||
│ ├── MessagesService.java # interface (contrat public)
|
||||
│ └── impl/
|
||||
│ └── YamlMessagesService.java # impl par défaut
|
||||
├── team/ # contrats + entités au top
|
||||
│ ├── Team.java # entité
|
||||
│ ├── TeamMember.java # entité
|
||||
│ ├── TeamRole.java # enum
|
||||
│ ├── TeamColor.java # enum
|
||||
│ ├── TeamVisibility.java # enum
|
||||
│ ├── TeamRanking.java # value
|
||||
│ ├── TeamService.java # interface
|
||||
│ ├── TeamRepository.java # interface
|
||||
│ ├── event/ # Bukkit events team
|
||||
│ │ ├── TeamEvent.java # base
|
||||
│ │ ├── TeamCreateEvent.java
|
||||
│ │ ├── TeamDissolveEvent.java
|
||||
│ │ ├── TeamMemberAddEvent.java
|
||||
│ │ ├── TeamMemberRemoveEvent.java
|
||||
│ │ ├── PlayerJoinTeamEvent.java
|
||||
│ │ ├── TeamLeadershipTransferEvent.java
|
||||
│ │ ├── TeamVisibilityChangeEvent.java
|
||||
│ │ ├── TeamScoreChangeEvent.java
|
||||
│ │ └── TeamSpawnPointChangeEvent.java
|
||||
│ ├── exception/ # hiérarchie d'exceptions team
|
||||
│ │ ├── TeamException.java # base
|
||||
│ │ ├── TeamAlreadyExistsException.java
|
||||
│ │ ├── TeamNotFoundException.java
|
||||
│ │ └── TeamAccessException.java
|
||||
│ └── impl/ # implémentations swappables
|
||||
│ ├── TeamServiceImpl.java # service de base
|
||||
│ ├── BukkitEventFiringTeamServiceImpl.java # impl par défaut
|
||||
│ ├── InMemoryTeamRepository.java # repo en mémoire
|
||||
│ └── SqliteTeamRepository.java # repo SQLite write-through
|
||||
└── player/ # contrats + entités au top
|
||||
├── PlayerProfile.java # entité
|
||||
├── PlayerRanking.java # value
|
||||
├── PlayerProfileService.java # interface
|
||||
├── PlayerProfileRepository.java # interface
|
||||
├── event/ # Bukkit events player
|
||||
│ ├── PlayerProfileEvent.java
|
||||
│ ├── PlayerProfileCreateEvent.java
|
||||
│ ├── PlayerProfileDeleteEvent.java
|
||||
│ └── PlayerScoreChangeEvent.java
|
||||
├── exception/
|
||||
│ ├── PlayerException.java
|
||||
│ └── PlayerProfileNotFoundException.java
|
||||
└── impl/
|
||||
├── PlayerProfileServiceImpl.java
|
||||
├── BukkitEventFiringPlayerProfileServiceImpl.java
|
||||
├── InMemoryPlayerProfileRepository.java
|
||||
└── SqlitePlayerProfileRepository.java
|
||||
```
|
||||
|
||||
## Fichier messages
|
||||
|
||||
Reference in New Issue
Block a user