feat: admin/chef/player permission model + leaderless teams + setleader
Commands: - Drop all short aliases (c/i/t/j/vis/disband/...) — long names only. - Every /core team <action> now has a crcore.team.<action> permission. - Three-tier model: * Admin (perm only): create, delete, setleader, score * Chef (perm + chef-check in execute): add, remove, transfer, visibility, setspawn * Player (perm): join, leave, info, list, top - delete now takes <team> as argument (admin); no more chef-disband shortcut. New /core team setleader <team> <player>: - Admin assigns or replaces a team's leader. - More permissive than transfer: target may not yet be a member (auto-add), and works on leaderless teams. Leaderless teams: - Team.leaderId is now nullable. - getLeaderId() and getLeader() return Optional<...>. - hasLeader() and isLeader(UUID) helpers added. - New constructors Team(id, name, tag, color [, visibility]) for leaderless. - TeamService.createTeam overloads without leaderId. - TeamService.setLeader(teamId, playerId): assigns/replaces leader (auto-adds as member if needed). Fires TeamLeadershipTransferEvent with optional old. - TeamLeadershipTransferEvent.getOldLeaderId() returns Optional<UUID>. - SqliteTeamRepository: leader_id column no longer NOT NULL. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
@startuml builtin-commands-diagram
|
||||
title CR-Core — Default /core team commands
|
||||
title CR-Core — Default /core team commands (admin / chef / joueur)
|
||||
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
@@ -13,7 +13,6 @@ package "fr.luc.crcore.command.builtin" {
|
||||
|
||||
class CoreCommand {
|
||||
+ CoreCommand(teamSvc, playerSvc)
|
||||
# registerDefaults(): void
|
||||
}
|
||||
CoreCommand --|> BaseCommand
|
||||
|
||||
@@ -29,44 +28,93 @@ package "fr.luc.crcore.command.builtin" {
|
||||
+ {static} teamByName(service): ArgumentType<Team>
|
||||
}
|
||||
|
||||
class TeamCreateSubCommand {
|
||||
+ execute(ctx): CommandResult
|
||||
' === ADMIN commands (permission seule) ===
|
||||
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>
|
||||
}
|
||||
}
|
||||
|
||||
' === CHEF commands (permission + check chef) ===
|
||||
package "chef" <<Rectangle>> {
|
||||
class TeamAddSubCommand {
|
||||
perm: crcore.team.add
|
||||
args: <player>
|
||||
}
|
||||
class TeamRemoveSubCommand {
|
||||
perm: crcore.team.remove
|
||||
args: <player>
|
||||
}
|
||||
class TeamTransferSubCommand {
|
||||
perm: crcore.team.transfer
|
||||
args: <player>
|
||||
}
|
||||
class TeamVisibilitySubCommand {
|
||||
perm: crcore.team.visibility
|
||||
args: <vis>
|
||||
}
|
||||
class TeamSetSpawnSubCommand {
|
||||
perm: crcore.team.setspawn
|
||||
}
|
||||
}
|
||||
|
||||
' === 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]
|
||||
}
|
||||
}
|
||||
class TeamDeleteSubCommand
|
||||
class TeamAddSubCommand
|
||||
class TeamRemoveSubCommand
|
||||
class TeamJoinSubCommand
|
||||
class TeamLeaveSubCommand
|
||||
class TeamInfoSubCommand
|
||||
class TeamListSubCommand
|
||||
class TeamTransferSubCommand
|
||||
class TeamVisibilitySubCommand
|
||||
class TeamScoreSubCommand
|
||||
class TeamTopSubCommand
|
||||
class TeamSetSpawnSubCommand
|
||||
|
||||
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
|
||||
TeamTransferSubCommand --|> SubCommand
|
||||
TeamVisibilitySubCommand --|> SubCommand
|
||||
TeamScoreSubCommand --|> SubCommand
|
||||
TeamTopSubCommand --|> SubCommand
|
||||
TeamSetSpawnSubCommand --|> SubCommand
|
||||
|
||||
CoreCommand "1" *-- "1" TeamGroupSubCommand : contains
|
||||
TeamGroupSubCommand "1" *-- "13" SubCommand : contains
|
||||
TeamGroupSubCommand "1" *-- "14" SubCommand : contains
|
||||
}
|
||||
}
|
||||
|
||||
note right of CoreCommand
|
||||
Le plugin de jeu downstream
|
||||
remplace une feuille avec :
|
||||
note bottom of TeamGroupSubCommand
|
||||
Override d'une feuille :
|
||||
core.getCoreCommand()
|
||||
.findSubCommand("team")
|
||||
.replaceSubCommand("create",
|
||||
|
||||
Reference in New Issue
Block a user