docs: organize diagrams to mirror code layout (util/ + features/)
Move flat docs/diagrams/*.puml into a hierarchy matching the source
package structure:
docs/diagrams/
├── bootstrap-sequence.puml (cross-cutting)
├── events-diagram.puml (cross-feature)
├── util/
│ ├── command-class-diagram.puml
│ ├── database-diagram.puml
│ ├── messages-class-diagram.puml
│ ├── broadcasts-class-diagram.puml
│ └── gui-class-diagram.puml
└── features/
├── team/
│ ├── team-class-diagram.puml
│ ├── team-config-class-diagram.puml
│ ├── builtin-commands-diagram.puml
│ ├── team-create-sequence.puml
│ ├── team-create-activity.puml
│ └── team-join-sequence.puml
├── player/
│ └── player-class-diagram.puml
└── moderation/
└── moderation-class-diagram.puml
README.md diagram index split into 4 sections (overview, util,
features/team, features/player, features/moderation) for readability;
all links updated. features.md auto-updated by sed for the new paths.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
@startuml command-class-diagram
|
||||
title CR-Core — Command framework (class diagram, nested sub-commands)
|
||||
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.util.command" {
|
||||
|
||||
interface Command {
|
||||
+ getName(): String
|
||||
+ getAliases(): List<String>
|
||||
+ getPermission(): String
|
||||
+ isPlayerOnly(): boolean
|
||||
+ getDescription(): String
|
||||
+ execute(ctx: CommandContext): CommandResult
|
||||
+ tabComplete(sender, args: String[]): List<String>
|
||||
+ matches(label: String): boolean
|
||||
}
|
||||
|
||||
abstract class AbstractCommand {
|
||||
- name: String
|
||||
- aliases: List<String>
|
||||
- permission: String
|
||||
- playerOnly: boolean
|
||||
- description: String
|
||||
- usage: String
|
||||
- arguments: List<ArgumentDef>
|
||||
- subCommandsByName: Map<String, SubCommand>
|
||||
- subCommandsByAlias: Map<String, SubCommand>
|
||||
--
|
||||
# addAlias(...) / permission / playerOnly / description / usage
|
||||
# argument(name, type) / optionalArgument(name, type)
|
||||
# addSubCommand(sub: SubCommand): void
|
||||
--
|
||||
+ findSubCommand(label): Optional<SubCommand>
|
||||
+ getSubCommands(): Collection<SubCommand>
|
||||
+ replaceSubCommand(name, newSub): Optional<SubCommand>
|
||||
+ hasSubCommands(): boolean
|
||||
--
|
||||
+ dispatch(sender, label, args): CommandResult
|
||||
+ tabComplete(sender, args): List<String>
|
||||
+ execute(ctx): CommandResult
|
||||
# listSubCommands(ctx): CommandResult
|
||||
# checkAccess(sender): boolean
|
||||
# buildContext(sender, label, rawArgs): CommandContext
|
||||
}
|
||||
|
||||
abstract class BaseCommand {
|
||||
+ onCommand(sender, cmd, label, args): boolean
|
||||
+ onTabComplete(sender, cmd, alias, args): List<String>
|
||||
# handleResult(sender, result): void
|
||||
}
|
||||
|
||||
abstract class SubCommand
|
||||
|
||||
class CommandContext {
|
||||
- sender: CommandSender
|
||||
- label: String
|
||||
- rawArgs: String[]
|
||||
- parsedArgs: Map<String, Object>
|
||||
+ getSender / isPlayer / getPlayer / requirePlayer
|
||||
+ get(name): T
|
||||
+ getOptional(name): Optional<T>
|
||||
+ has(name): boolean
|
||||
+ reply(msg): void
|
||||
}
|
||||
|
||||
class CommandResult {
|
||||
- type: Type
|
||||
- message: String
|
||||
+ {static} success / failure / invalidUsage / noPermission / playerOnly
|
||||
}
|
||||
|
||||
enum "CommandResult.Type" as ResultType {
|
||||
SUCCESS
|
||||
FAILURE
|
||||
INVALID_USAGE
|
||||
NO_PERMISSION
|
||||
PLAYER_ONLY
|
||||
}
|
||||
|
||||
class CommandException
|
||||
|
||||
interface "ArgumentType<T>" as ArgumentType {
|
||||
+ parse(input: String): T
|
||||
+ suggestions(sender, partial): List<String>
|
||||
}
|
||||
|
||||
class ArgumentTypes <<utility>> {
|
||||
+ STRING / INTEGER / DOUBLE / BOOLEAN / ONLINE_PLAYER
|
||||
+ enumOf(Class<E>): ArgumentType<E>
|
||||
+ choice(String...): ArgumentType<String>
|
||||
}
|
||||
|
||||
class ArgumentDef <<package-private>> {
|
||||
- name: String
|
||||
- type: ArgumentType<?>
|
||||
- required: boolean
|
||||
}
|
||||
|
||||
AbstractCommand ..|> Command
|
||||
BaseCommand --|> AbstractCommand
|
||||
SubCommand --|> AbstractCommand
|
||||
BaseCommand ..|> "org.bukkit.command.CommandExecutor"
|
||||
BaseCommand ..|> "org.bukkit.command.TabCompleter"
|
||||
|
||||
AbstractCommand "1" o-- "*" SubCommand : sub-commands\n(recursive)
|
||||
AbstractCommand "1" *-- "*" ArgumentDef : arguments
|
||||
ArgumentDef --> ArgumentType
|
||||
CommandResult +-- ResultType
|
||||
CommandException --|> RuntimeException
|
||||
|
||||
AbstractCommand ..> CommandContext : creates
|
||||
AbstractCommand ..> CommandResult : returns
|
||||
}
|
||||
|
||||
note bottom of AbstractCommand
|
||||
Le routage est récursif :
|
||||
/core team create → CoreCommand.dispatch("team", ["create",...])
|
||||
→ TeamGroup.dispatch("create", [...])
|
||||
→ TeamCreate.execute(ctx)
|
||||
end note
|
||||
|
||||
@enduml
|
||||
Reference in New Issue
Block a user