refactor: split util/ vs features/ + modular opt-in setupX() config
Package restructure to prepare future modularization. Three layers now:
1. fr.luc.crcore.util.* (always active)
- common, command framework, database, message, broadcast, gui,
placeholder
2. fr.luc.crcore.features.* (opt-in)
- team (entities, services, repos, events, exceptions, config + GUI,
command/Team*SubCommand)
- player (profile, ranking, services, repos, events, exceptions)
3. fr.luc.crcore.builtin.*
- CoreCommand + CoreReloadSubCommand (top-level routing — not a
feature, not an util)
FQN moves (game plugins importing these need their imports updated):
- fr.luc.crcore.common.* → fr.luc.crcore.util.common.*
- fr.luc.crcore.command.* → fr.luc.crcore.util.command.*
- fr.luc.crcore.command.builtin.team.*
→ fr.luc.crcore.features.team.command.*
- fr.luc.crcore.command.builtin.CoreCommand / CoreReloadSubCommand
→ fr.luc.crcore.builtin.*
- fr.luc.crcore.database.* → fr.luc.crcore.util.database.*
- fr.luc.crcore.message.* → fr.luc.crcore.util.message.*
- fr.luc.crcore.broadcast.* → fr.luc.crcore.util.broadcast.*
- fr.luc.crcore.gui.* → fr.luc.crcore.util.gui.*
- fr.luc.crcore.placeholder.* → fr.luc.crcore.util.placeholder.*
- fr.luc.crcore.team.* → fr.luc.crcore.features.team.*
- fr.luc.crcore.player.* → fr.luc.crcore.features.player.*
CRCoreConfig — features opt-in via fluent setup:
- setupTeams() enables team feature
- setupPlayers() enables player feature
- setupPlaceholders() enables PAPI integration
- setupAll() shortcut
By default no feature is active. Game plugin must opt-in.
CRCore.enable() now conditional:
- Util services always built (messages, broadcasts, gui listener).
- Team services + repos + config built only if setupTeams().
- Player services + repos built only if setupPlayers().
- Placeholder hook registered only if setupPlaceholders() (and PAPI
installed at runtime).
- Getters of disabled features throw IllegalStateException with a clear
message pointing to the missing setupX() call.
- CoreCommand only registers TeamGroupSubCommand if teamService and
teamConfig are non-null. CoreReloadSubCommand handles teamConfig=null
(just skips that reload). /core reload always available.
Docs:
- setup.md tree fully rewritten to reflect util/+features/+builtin
layout (~70 lines of arborescence).
- setup.md code snippet shows the three opt-in patterns (setupAll /
granular / with options).
- decisions.md logs both decisions (restructure + modular setup).
- All .puml diagrams auto-updated to new FQNs.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ title CR-Core — Broadcast service (class diagram)
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.broadcast" {
|
||||
package "fr.luc.crcore.util.broadcast" {
|
||||
|
||||
enum BroadcastAudience {
|
||||
NONE
|
||||
@@ -54,7 +54,7 @@ package "fr.luc.crcore.broadcast" {
|
||||
}
|
||||
CRCoreBroadcastListener ..|> "org.bukkit.event.Listener"
|
||||
|
||||
package "fr.luc.crcore.broadcast.impl" {
|
||||
package "fr.luc.crcore.util.broadcast.impl" {
|
||||
class YamlBroadcastService {
|
||||
- plugin: JavaPlugin
|
||||
- messages: MessagesService
|
||||
@@ -73,7 +73,7 @@ package "fr.luc.crcore.broadcast" {
|
||||
|
||||
BroadcastService ..> BroadcastContext : consumes
|
||||
BroadcastContext --> BroadcastAudience
|
||||
YamlBroadcastService --> "fr.luc.crcore.message.MessagesService" : reads templates
|
||||
YamlBroadcastService --> "fr.luc.crcore.util.message.MessagesService" : reads templates
|
||||
CRCoreBroadcastListener --> BroadcastService : delegates
|
||||
CRCoreBroadcastListener ..> BroadcastContext : builds
|
||||
}
|
||||
|
||||
@@ -4,17 +4,17 @@ title CR-Core — Default /core team commands (admin / joueur)
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.command" {
|
||||
package "fr.luc.crcore.util.command" {
|
||||
abstract class BaseCommand
|
||||
abstract class SubCommand
|
||||
}
|
||||
|
||||
package "fr.luc.crcore.command.builtin" {
|
||||
package "fr.luc.crcore.builtin" {
|
||||
|
||||
class CoreCommand
|
||||
CoreCommand --|> BaseCommand
|
||||
|
||||
package "fr.luc.crcore.command.builtin.team" {
|
||||
package "fr.luc.crcore.features.team.command" {
|
||||
|
||||
class TeamGroupSubCommand {
|
||||
+ TeamGroupSubCommand(service)
|
||||
|
||||
@@ -4,7 +4,7 @@ title CR-Core — Command framework (class diagram, nested sub-commands)
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.command" {
|
||||
package "fr.luc.crcore.util.command" {
|
||||
|
||||
interface Command {
|
||||
+ getName(): String
|
||||
|
||||
@@ -4,7 +4,7 @@ title CR-Core — Database (SQLite wrapper)
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.database" {
|
||||
package "fr.luc.crcore.util.database" {
|
||||
|
||||
class Database {
|
||||
- connection: Connection
|
||||
|
||||
@@ -8,7 +8,7 @@ package "org.bukkit.event" {
|
||||
abstract class Event
|
||||
}
|
||||
|
||||
package "fr.luc.crcore.team.event" {
|
||||
package "fr.luc.crcore.features.team.event" {
|
||||
|
||||
abstract class TeamEvent {
|
||||
- team: Team
|
||||
@@ -57,7 +57,7 @@ package "fr.luc.crcore.team.event" {
|
||||
TeamSpawnPointChangeEvent --|> TeamEvent
|
||||
}
|
||||
|
||||
package "fr.luc.crcore.player.event" {
|
||||
package "fr.luc.crcore.features.player.event" {
|
||||
|
||||
abstract class PlayerProfileEvent {
|
||||
- profile: PlayerProfile
|
||||
|
||||
@@ -4,7 +4,7 @@ title CR-Core — GUI framework (class diagram, réutilisable)
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.gui" {
|
||||
package "fr.luc.crcore.util.gui" {
|
||||
|
||||
abstract class AbstractInventoryGui {
|
||||
- inventory: Inventory
|
||||
|
||||
@@ -4,7 +4,7 @@ title CR-Core — Messages service (class diagram)
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.message" {
|
||||
package "fr.luc.crcore.util.message" {
|
||||
|
||||
interface MessagesService {
|
||||
+ get(key, placeholderPairs...): String
|
||||
|
||||
@@ -6,7 +6,7 @@ hide empty members
|
||||
|
||||
' === Common abstractions ===
|
||||
|
||||
package "fr.luc.crcore.common" {
|
||||
package "fr.luc.crcore.util.common" {
|
||||
|
||||
interface Identifiable {
|
||||
+ getId(): UUID
|
||||
@@ -40,7 +40,7 @@ package "fr.luc.crcore.common" {
|
||||
|
||||
' === Player domain ===
|
||||
|
||||
package "fr.luc.crcore.player" {
|
||||
package "fr.luc.crcore.features.player" {
|
||||
|
||||
class PlayerProfile {
|
||||
- scores: Map<String, Integer>
|
||||
|
||||
@@ -6,7 +6,7 @@ hide empty members
|
||||
|
||||
' === Common abstractions ===
|
||||
|
||||
package "fr.luc.crcore.common" {
|
||||
package "fr.luc.crcore.util.common" {
|
||||
|
||||
interface Identifiable {
|
||||
+ getId(): UUID
|
||||
@@ -47,7 +47,7 @@ package "fr.luc.crcore.common" {
|
||||
|
||||
' === Team domain ===
|
||||
|
||||
package "fr.luc.crcore.team" {
|
||||
package "fr.luc.crcore.features.team" {
|
||||
|
||||
enum TeamRole {
|
||||
LEADER
|
||||
|
||||
@@ -4,7 +4,7 @@ title CR-Core — Team config (class diagram, cascade per-team → global → de
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.team.config" {
|
||||
package "fr.luc.crcore.features.team.config" {
|
||||
|
||||
class "TeamSetting<T>" as TeamSetting <<final>> {
|
||||
- key: String
|
||||
@@ -60,7 +60,7 @@ package "fr.luc.crcore.team.config" {
|
||||
+ getGlobalFileName(): Optional<String>
|
||||
}
|
||||
|
||||
package "fr.luc.crcore.team.config.impl" {
|
||||
package "fr.luc.crcore.features.team.config.impl" {
|
||||
class YamlTeamConfigService {
|
||||
- plugin: JavaPlugin
|
||||
- teamRepository: TeamRepository
|
||||
@@ -77,14 +77,14 @@ package "fr.luc.crcore.team.config" {
|
||||
TeamConfigService ..> TeamSetting : reads/writes
|
||||
}
|
||||
|
||||
package "fr.luc.crcore.team" {
|
||||
package "fr.luc.crcore.features.team" {
|
||||
class Team {
|
||||
- settings: Map<String, Object>
|
||||
+ getSettings(): Map<String, Object>
|
||||
}
|
||||
}
|
||||
|
||||
package "fr.luc.crcore.team.config.gui" {
|
||||
package "fr.luc.crcore.features.team.config.gui" {
|
||||
abstract class AbstractSettingsGui {
|
||||
- rebuild() : peint la grille
|
||||
# {abstract} getCurrentValue(setting): T
|
||||
@@ -96,14 +96,14 @@ package "fr.luc.crcore.team.config.gui" {
|
||||
class TeamSettingsGui
|
||||
GlobalSettingsGui --|> AbstractSettingsGui
|
||||
TeamSettingsGui --|> AbstractSettingsGui
|
||||
AbstractSettingsGui --|> "fr.luc.crcore.gui.AbstractInventoryGui"
|
||||
AbstractSettingsGui --|> "fr.luc.crcore.util.gui.AbstractInventoryGui"
|
||||
|
||||
GlobalSettingsGui --> TeamConfigService
|
||||
TeamSettingsGui --> TeamConfigService
|
||||
TeamSettingsGui --> Team
|
||||
}
|
||||
|
||||
YamlTeamConfigService --> "fr.luc.crcore.team.TeamRepository" : persists per-team via save()
|
||||
YamlTeamConfigService --> "fr.luc.crcore.features.team.TeamRepository" : persists per-team via save()
|
||||
TeamConfigService ..> Team : reads/writes settings map
|
||||
|
||||
note bottom of YamlTeamConfigService
|
||||
|
||||
Reference in New Issue
Block a user