Files
Cites_Plugins/docs/diagrams/builtin-commands-diagram.puml
T
Antone Barbaud 84735221f1 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>
2026-06-10 12:00:00 +02:00

125 lines
3.2 KiB
Plaintext

@startuml builtin-commands-diagram
title CR-Core — Default /core team commands (admin / joueur)
skinparam classAttributeIconSize 0
hide empty members
package "fr.luc.crcore.util.command" {
abstract class BaseCommand
abstract class SubCommand
}
package "fr.luc.crcore.builtin" {
class CoreCommand
CoreCommand --|> BaseCommand
package "fr.luc.crcore.features.team.command" {
class TeamGroupSubCommand {
+ TeamGroupSubCommand(service)
}
TeamGroupSubCommand --|> SubCommand
class TeamArgumentTypes <<utility>> {
+ {static} teamByName(service): ArgumentType<Team>
}
' ─── ADMIN commands (permission seule, team par argument) ───
package "admin" <<Rectangle>> {
class TeamCreateSubCommand {
perm: crcore.team.create
args: name, tag, color, [leader]
}
class TeamDeleteSubCommand {
perm: crcore.team.delete
args: <team>
}
class TeamSetLeaderSubCommand {
perm: crcore.team.setleader
args: <team> <player>
}
class TeamScoreSubCommand {
perm: crcore.team.score
args: <team> <name> <add|set> <value>
}
class TeamAddSubCommand {
perm: crcore.team.add
args: <team> <player>
}
class TeamRemoveSubCommand {
perm: crcore.team.remove
args: <team> <player>
}
class TeamTransferSubCommand {
perm: crcore.team.transfer
args: <team> <player>
}
class TeamVisibilitySubCommand {
perm: crcore.team.visibility
args: <team> <vis>
}
class TeamSetSpawnSubCommand {
perm: crcore.team.setspawn
args: <team>
playerOnly
}
}
' ─── PLAYER commands ───
package "player" <<Rectangle>> {
class TeamJoinSubCommand {
perm: crcore.team.join
args: <team>
}
class TeamLeaveSubCommand {
perm: crcore.team.leave
}
class TeamInfoSubCommand {
perm: crcore.team.info
args: [team]
}
class TeamListSubCommand {
perm: crcore.team.list
}
class TeamTopSubCommand {
perm: crcore.team.top
args: [score]
}
}
TeamCreateSubCommand --|> SubCommand
TeamDeleteSubCommand --|> SubCommand
TeamSetLeaderSubCommand --|> SubCommand
TeamScoreSubCommand --|> SubCommand
TeamAddSubCommand --|> SubCommand
TeamRemoveSubCommand --|> SubCommand
TeamTransferSubCommand --|> SubCommand
TeamVisibilitySubCommand --|> SubCommand
TeamSetSpawnSubCommand --|> SubCommand
TeamJoinSubCommand --|> SubCommand
TeamLeaveSubCommand --|> SubCommand
TeamInfoSubCommand --|> SubCommand
TeamListSubCommand --|> SubCommand
TeamTopSubCommand --|> SubCommand
CoreCommand "1" *-- "1" TeamGroupSubCommand : contains
TeamGroupSubCommand "1" *-- "14" SubCommand : contains
}
}
note bottom of TeamGroupSubCommand
Le rôle LEADER reste dans le modèle Team
(utilisable par les game plugins via l'API)
mais n'accorde aucun privilège de commande
dans le set par défaut.
Override d'une feuille :
core.getCoreCommand()
.findSubCommand("team")
.replaceSubCommand("create",
new MyCreate(svc));
end note
@enduml