@startuml team-create-sequence title CR-Core — Create Team via command framework (sequence diagram) actor Player participant "BaseCommand\n(TeamCommand)" as Base participant "SubCommand\n(TeamCreateSub)" as Sub participant "TeamService" as Service participant "TeamRepository" as Repo participant "Team" as Team Player -> Base : /team create activate Base Base -> Base : route args[0]="create" → TeamCreateSub Base -> Base : check permission + playerOnly Base -> Sub : buildContext(sender, label, subArgs) activate Sub Sub -> Sub : parse name (STRING) / tag (STRING) / color (enumOf TeamColor) Sub --> Base : CommandContext deactivate Sub Base -> Sub : execute(ctx) activate Sub Sub -> Service : createTeam(name, tag, color, playerId) activate Service Service -> Service : validateName(name) Service -> Repo : findByName(name) activate Repo Repo --> Service : Optional.empty() deactivate Repo Service -> Service : validateTag(tag) Service -> Repo : findByTag(tag) activate Repo Repo --> Service : Optional.empty() deactivate Repo Service -> Service : validateLeader(playerId) Service -> Repo : findByMember(playerId) activate Repo Repo --> Service : Optional.empty() deactivate Repo Service -> Team : newTeam(UUID.randomUUID(), name, tag, color, playerId, PRIVATE) activate Team Team -> Team : add newMember(playerId, LEADER) Team --> Service : team deactivate Team Service -> Service : onBeforeSave(team) Service -> Repo : save(team) activate Repo Repo --> Service : team deactivate Repo Service -> Service : onAfterCreate(team) Service --> Sub : team deactivate Service Sub --> Base : CommandResult.success("Team created") deactivate Sub Base -> Base : handleResult → sender.sendMessage(green text) Base --> Player : "Team created" deactivate Base @enduml