84735221f1
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>
103 lines
3.0 KiB
Plaintext
103 lines
3.0 KiB
Plaintext
@startuml broadcasts-class-diagram
|
|
title CR-Core — Broadcast service (class diagram)
|
|
|
|
skinparam classAttributeIconSize 0
|
|
hide empty members
|
|
|
|
package "fr.luc.crcore.util.broadcast" {
|
|
|
|
enum BroadcastAudience {
|
|
NONE
|
|
LEADER
|
|
TEAM
|
|
ADMIN
|
|
ALL
|
|
}
|
|
|
|
class BroadcastContext {
|
|
- team: Team
|
|
- involvedPlayerId: UUID
|
|
- placeholders: Map<String, String>
|
|
--
|
|
+ {static} of(team): BroadcastContext
|
|
+ {static} empty(): BroadcastContext
|
|
+ involving(playerId): BroadcastContext
|
|
+ with(key, value): BroadcastContext
|
|
+ getTeam(): Optional<Team>
|
|
+ getInvolvedPlayerId(): Optional<UUID>
|
|
+ getPlaceholders(): Map<String, String>
|
|
+ toPlaceholderPairs(): Object[]
|
|
}
|
|
|
|
interface BroadcastService {
|
|
+ broadcast(eventKey, context): void
|
|
+ getAudiences(eventKey): List<BroadcastAudience>
|
|
+ reload(): void
|
|
}
|
|
|
|
class CRCoreBroadcastListener {
|
|
- broadcasts: BroadcastService
|
|
+ registerOn(plugin: JavaPlugin): void
|
|
--
|
|
@ onTeamCreate(TeamCreateEvent)
|
|
@ onTeamDissolve(TeamDissolveEvent)
|
|
@ onTeamMemberAdd(TeamMemberAddEvent)
|
|
@ onTeamMemberRemove(TeamMemberRemoveEvent)
|
|
@ onPlayerJoinTeam(PlayerJoinTeamEvent)
|
|
@ onLeadershipTransfer(TeamLeadershipTransferEvent)
|
|
@ onVisibilityChange(TeamVisibilityChangeEvent)
|
|
@ onTeamScoreChange(TeamScoreChangeEvent)
|
|
@ onTeamSpawnChange(TeamSpawnPointChangeEvent)
|
|
@ onProfileCreate(PlayerProfileCreateEvent)
|
|
@ onProfileDelete(PlayerProfileDeleteEvent)
|
|
@ onPlayerScoreChange(PlayerScoreChangeEvent)
|
|
}
|
|
CRCoreBroadcastListener ..|> "org.bukkit.event.Listener"
|
|
|
|
package "fr.luc.crcore.util.broadcast.impl" {
|
|
class YamlBroadcastService {
|
|
- plugin: JavaPlugin
|
|
- messages: MessagesService
|
|
- defaults: Map<String, List<BroadcastAudience>>
|
|
- audiences: Map<String, List<BroadcastAudience>>
|
|
- userFile: File
|
|
--
|
|
+ YamlBroadcastService(plugin, messages)
|
|
- loadDefaultsFromResource(): void
|
|
- ensureUserFile(): void
|
|
- rebuildEffectiveAudiences(): void
|
|
- resolveRecipients(list, ctx): Set<Player>
|
|
}
|
|
YamlBroadcastService ..|> BroadcastService
|
|
}
|
|
|
|
BroadcastService ..> BroadcastContext : consumes
|
|
BroadcastContext --> BroadcastAudience
|
|
YamlBroadcastService --> "fr.luc.crcore.util.message.MessagesService" : reads templates
|
|
CRCoreBroadcastListener --> BroadcastService : delegates
|
|
CRCoreBroadcastListener ..> BroadcastContext : builds
|
|
}
|
|
|
|
package "fr.luc.crcore" {
|
|
class CRCore {
|
|
+ broadcasts(): BroadcastService
|
|
# buildBroadcastService(messages): BroadcastService
|
|
}
|
|
CRCore "1" *-- "1" BroadcastService : owns
|
|
CRCore ..> CRCoreBroadcastListener : registers
|
|
}
|
|
|
|
note bottom of YamlBroadcastService
|
|
Modèle "un seul fichier par plugin" :
|
|
|
|
Sources en mémoire :
|
|
1. crcore-broadcasts.yml ← jar (fallback)
|
|
2. <plugin>-broadcasts.yml ← dataFolder (édité par l'admin)
|
|
|
|
Séparation routes / templates :
|
|
- Routes = ce fichier (qui reçoit quoi)
|
|
- Templates = MessagesService (clés <event>.broadcast)
|
|
end note
|
|
|
|
@enduml
|