ffc77c4213
Pure Maven library for CR Minecraft game plugins, targeting Paper 1.16.5. Common abstractions (fr.luc.crcore.common): Identifiable, Named, ScoreHolder, AbstractEntity, Repository<T>. Team domain (fr.luc.crcore.team): Team entity with name/tag/color/leader/ visibility (PUBLIC|PRIVATE)/members/scores/spawn point, TeamMember, TeamRole/TeamColor/TeamVisibility enums, TeamRanking record, TeamService with overridable hooks (factories, validations, lifecycle events), in-memory repository, dedicated exception hierarchy. Player domain (fr.luc.crcore.player): PlayerProfile with named scores per player, PlayerProfileService with auto-creation, individual rankings, exception hierarchy. Both Team and PlayerProfile implement ScoreHolder. Command framework (fr.luc.crcore.command): Command interface, AbstractCommand base, BaseCommand (CommandExecutor + TabCompleter), SubCommand, CommandContext, CommandResult, ArgumentType<T> + ArgumentTypes catalogue (STRING, INTEGER, DOUBLE, BOOLEAN, ONLINE_PLAYER, enumOf, choice). Docs (docs/) is the single source of truth: README, setup, features, decisions log, and 6 PlantUML diagrams (team class/sequence/activity/join, player class, command class). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
111 lines
2.7 KiB
Plaintext
111 lines
2.7 KiB
Plaintext
@startuml player-class-diagram
|
|
title CR-Core — Player domain (class diagram)
|
|
|
|
skinparam classAttributeIconSize 0
|
|
hide empty members
|
|
|
|
' === Common abstractions ===
|
|
|
|
package "fr.luc.crcore.common" {
|
|
|
|
interface Identifiable {
|
|
+ getId(): UUID
|
|
}
|
|
|
|
interface ScoreHolder {
|
|
+ getScore(name): int
|
|
+ hasScore(name): boolean
|
|
+ getScores(): Map<String, Integer>
|
|
+ getTotalScore(): int
|
|
+ addScore(name, delta): int
|
|
+ setScore(name, value): int
|
|
+ resetScore(name): boolean
|
|
+ resetAllScores(): void
|
|
}
|
|
|
|
abstract class AbstractEntity {
|
|
- id: UUID
|
|
+ getId(): UUID
|
|
}
|
|
|
|
interface "Repository<T extends Identifiable>" as Repository {
|
|
+ save(entity: T): T
|
|
+ findById(id): Optional<T>
|
|
+ findAll(): Collection<T>
|
|
+ delete(id): boolean
|
|
}
|
|
|
|
AbstractEntity ..|> Identifiable
|
|
}
|
|
|
|
' === Player domain ===
|
|
|
|
package "fr.luc.crcore.player" {
|
|
|
|
class PlayerProfile {
|
|
- scores: Map<String, Integer>
|
|
+ PlayerProfile(playerId: UUID)
|
|
+ getPlayerId(): UUID
|
|
}
|
|
|
|
class PlayerRanking <<record>> {
|
|
+ rank: int
|
|
+ profile: PlayerProfile
|
|
+ score: int
|
|
}
|
|
|
|
interface PlayerProfileRepository
|
|
|
|
class InMemoryPlayerProfileRepository {
|
|
- profiles: Map<UUID, PlayerProfile>
|
|
}
|
|
|
|
interface PlayerProfileService {
|
|
+ getOrCreateProfile(playerId): PlayerProfile
|
|
+ getProfile(playerId): Optional<PlayerProfile>
|
|
+ deleteProfile(playerId): boolean
|
|
+ getAllProfiles(): Collection<PlayerProfile>
|
|
--
|
|
+ addScore(playerId, name, delta): int
|
|
+ setScore(playerId, name, value): int
|
|
+ getScore(playerId, name): int
|
|
+ resetScore(playerId, name): boolean
|
|
+ resetAllScores(playerId): void
|
|
--
|
|
+ getRankingByScore(name): List<PlayerRanking>
|
|
+ getGlobalRanking(): List<PlayerRanking>
|
|
+ getTopRankingByScore(name, limit): List<PlayerRanking>
|
|
+ getTopGlobalRanking(limit): List<PlayerRanking>
|
|
}
|
|
|
|
class PlayerProfileServiceImpl {
|
|
- repository: PlayerProfileRepository
|
|
--
|
|
# newProfile(playerId): PlayerProfile
|
|
# newRanking(rank, profile, score): PlayerRanking
|
|
# rank(scoreFn): List<PlayerRanking>
|
|
--
|
|
# onProfileCreated(profile): void
|
|
# onProfileDeleted(profile): void
|
|
# onScoreChanged(profile, name, oldV, newV): void
|
|
}
|
|
|
|
class PlayerException
|
|
class PlayerProfileNotFoundException
|
|
|
|
PlayerProfile --|> AbstractEntity
|
|
PlayerProfile ..|> ScoreHolder
|
|
PlayerProfileRepository --|> Repository
|
|
InMemoryPlayerProfileRepository ..|> PlayerProfileRepository
|
|
PlayerProfileServiceImpl ..|> PlayerProfileService
|
|
|
|
PlayerRanking --> PlayerProfile
|
|
PlayerProfileServiceImpl o--> PlayerProfileRepository
|
|
PlayerProfileService ..> PlayerRanking : produces
|
|
|
|
PlayerException --|> RuntimeException
|
|
PlayerProfileNotFoundException --|> PlayerException
|
|
}
|
|
|
|
@enduml
|