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>
This commit is contained in:
@@ -367,6 +367,70 @@ Format léger : une décision = un titre + contexte + choix + raison.
|
||||
bases existantes, ALTER TABLE manuel ou suppression du fichier
|
||||
(les bases d'event sont jetables).
|
||||
|
||||
## 2026-06-10 — Réorganisation : `util/` (toujours) vs `features/` (opt-in)
|
||||
|
||||
- **Choix** : séparation nette en deux couches :
|
||||
- `fr.luc.crcore.util.*` — couche **utilitaire**, toujours active : common,
|
||||
command framework, database, message, broadcast, gui, placeholder.
|
||||
- `fr.luc.crcore.features.*` — couche **features**, opt-in : team, player.
|
||||
- `fr.luc.crcore.builtin.*` — les commandes top-level CoreCommand +
|
||||
CoreReloadSubCommand (pas un util, pas une feature, mais le routing
|
||||
global).
|
||||
- **Renames de FQN** (importer côté plugin de jeu si on les utilise) :
|
||||
- `fr.luc.crcore.common.*` → `fr.luc.crcore.util.common.*`
|
||||
- `fr.luc.crcore.command.*` → `fr.luc.crcore.util.command.*`
|
||||
(le framework — Command, BaseCommand, SubCommand, ArgumentType…)
|
||||
- `fr.luc.crcore.command.builtin.team.*`
|
||||
→ `fr.luc.crcore.features.team.command.*`
|
||||
(les 14+ Team*SubCommand)
|
||||
- `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.*`
|
||||
(et sous-packages event/exception/impl/config)
|
||||
- `fr.luc.crcore.player.*` → `fr.luc.crcore.features.player.*`
|
||||
- **Raison** : prépare la modularisation à long terme. Chaque feature est
|
||||
isolée dans son sous-package `features/<nom>/` et peut éventuellement
|
||||
être extraite en module Maven séparé plus tard. Les utils sont
|
||||
partagés. Le top-level reste minimal (CRCore, CRCoreConfig, builtin).
|
||||
|
||||
## 2026-06-10 — Setup modulaire via `CRCoreConfig.setupX()`
|
||||
|
||||
- **Choix** : les features sont désormais **opt-in**. Par défaut une
|
||||
instance de `CRCoreConfig` n'active **aucune** feature ; le plugin de
|
||||
jeu opt-in via :
|
||||
- `setupTeams()` — active team service, repo, config + GUI, sous-cmds
|
||||
- `setupPlayers()` — active player profile service + repo
|
||||
- `setupPlaceholders()` — active la hook PAPI (no-op si PAPI absent)
|
||||
- `setupAll()` — raccourci, active tout
|
||||
- **Comportement quand off** : les getters de service (ex.
|
||||
`core.getTeamService()`) lèvent `IllegalStateException` avec un
|
||||
message explicite. Les commandes built-in correspondantes ne sont
|
||||
simplement pas enregistrées (ex. `/core team` n'existe pas si teams
|
||||
off).
|
||||
- **Util toujours actif** : messages, broadcasts, GUI framework, command
|
||||
framework, database sont systématiquement chargés. C'est la couche
|
||||
infrastructure que les features et les game plugins consomment.
|
||||
- **Listeners Bukkit toujours register** : `CRCoreBroadcastListener` et
|
||||
`GuiListener` sont register unconditionnellement. Si aucune feature ne
|
||||
tire d'event, ils sont idle — aucun coût.
|
||||
- **Snippet d'usage** :
|
||||
```java
|
||||
this.core = new CRCore(this,
|
||||
new CRCoreConfig().setupAll()).enable();
|
||||
// ou granular :
|
||||
this.core = new CRCore(this,
|
||||
new CRCoreConfig().setupTeams()).enable();
|
||||
```
|
||||
- **Raison** : un game plugin qui n'a pas besoin des teams ne charge
|
||||
pas le service ; pas de fichier `<plugin>-team-config.yml` créé, pas
|
||||
de table `crcore_teams` créée, pas de sous-commande `/core team`. La
|
||||
surface est minimale par défaut.
|
||||
|
||||
## 2026-06-10 — Settings d'équipe : cascade per-team → global → default + GUI
|
||||
|
||||
- **Choix** : nouveau module `fr.luc.crcore.team.config` avec :
|
||||
|
||||
@@ -4,7 +4,7 @@ title CR-Core — Broadcast service (class diagram)
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.broadcast" {
|
||||
package "fr.luc.crcore.util.broadcast" {
|
||||
|
||||
enum BroadcastAudience {
|
||||
NONE
|
||||
@@ -54,7 +54,7 @@ package "fr.luc.crcore.broadcast" {
|
||||
}
|
||||
CRCoreBroadcastListener ..|> "org.bukkit.event.Listener"
|
||||
|
||||
package "fr.luc.crcore.broadcast.impl" {
|
||||
package "fr.luc.crcore.util.broadcast.impl" {
|
||||
class YamlBroadcastService {
|
||||
- plugin: JavaPlugin
|
||||
- messages: MessagesService
|
||||
@@ -73,7 +73,7 @@ package "fr.luc.crcore.broadcast" {
|
||||
|
||||
BroadcastService ..> BroadcastContext : consumes
|
||||
BroadcastContext --> BroadcastAudience
|
||||
YamlBroadcastService --> "fr.luc.crcore.message.MessagesService" : reads templates
|
||||
YamlBroadcastService --> "fr.luc.crcore.util.message.MessagesService" : reads templates
|
||||
CRCoreBroadcastListener --> BroadcastService : delegates
|
||||
CRCoreBroadcastListener ..> BroadcastContext : builds
|
||||
}
|
||||
|
||||
@@ -4,17 +4,17 @@ title CR-Core — Default /core team commands (admin / joueur)
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.command" {
|
||||
package "fr.luc.crcore.util.command" {
|
||||
abstract class BaseCommand
|
||||
abstract class SubCommand
|
||||
}
|
||||
|
||||
package "fr.luc.crcore.command.builtin" {
|
||||
package "fr.luc.crcore.builtin" {
|
||||
|
||||
class CoreCommand
|
||||
CoreCommand --|> BaseCommand
|
||||
|
||||
package "fr.luc.crcore.command.builtin.team" {
|
||||
package "fr.luc.crcore.features.team.command" {
|
||||
|
||||
class TeamGroupSubCommand {
|
||||
+ TeamGroupSubCommand(service)
|
||||
|
||||
@@ -4,7 +4,7 @@ title CR-Core — Command framework (class diagram, nested sub-commands)
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.command" {
|
||||
package "fr.luc.crcore.util.command" {
|
||||
|
||||
interface Command {
|
||||
+ getName(): String
|
||||
|
||||
@@ -4,7 +4,7 @@ title CR-Core — Database (SQLite wrapper)
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.database" {
|
||||
package "fr.luc.crcore.util.database" {
|
||||
|
||||
class Database {
|
||||
- connection: Connection
|
||||
|
||||
@@ -8,7 +8,7 @@ package "org.bukkit.event" {
|
||||
abstract class Event
|
||||
}
|
||||
|
||||
package "fr.luc.crcore.team.event" {
|
||||
package "fr.luc.crcore.features.team.event" {
|
||||
|
||||
abstract class TeamEvent {
|
||||
- team: Team
|
||||
@@ -57,7 +57,7 @@ package "fr.luc.crcore.team.event" {
|
||||
TeamSpawnPointChangeEvent --|> TeamEvent
|
||||
}
|
||||
|
||||
package "fr.luc.crcore.player.event" {
|
||||
package "fr.luc.crcore.features.player.event" {
|
||||
|
||||
abstract class PlayerProfileEvent {
|
||||
- profile: PlayerProfile
|
||||
|
||||
@@ -4,7 +4,7 @@ title CR-Core — GUI framework (class diagram, réutilisable)
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.gui" {
|
||||
package "fr.luc.crcore.util.gui" {
|
||||
|
||||
abstract class AbstractInventoryGui {
|
||||
- inventory: Inventory
|
||||
|
||||
@@ -4,7 +4,7 @@ title CR-Core — Messages service (class diagram)
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.message" {
|
||||
package "fr.luc.crcore.util.message" {
|
||||
|
||||
interface MessagesService {
|
||||
+ get(key, placeholderPairs...): String
|
||||
|
||||
@@ -6,7 +6,7 @@ hide empty members
|
||||
|
||||
' === Common abstractions ===
|
||||
|
||||
package "fr.luc.crcore.common" {
|
||||
package "fr.luc.crcore.util.common" {
|
||||
|
||||
interface Identifiable {
|
||||
+ getId(): UUID
|
||||
@@ -40,7 +40,7 @@ package "fr.luc.crcore.common" {
|
||||
|
||||
' === Player domain ===
|
||||
|
||||
package "fr.luc.crcore.player" {
|
||||
package "fr.luc.crcore.features.player" {
|
||||
|
||||
class PlayerProfile {
|
||||
- scores: Map<String, Integer>
|
||||
|
||||
@@ -6,7 +6,7 @@ hide empty members
|
||||
|
||||
' === Common abstractions ===
|
||||
|
||||
package "fr.luc.crcore.common" {
|
||||
package "fr.luc.crcore.util.common" {
|
||||
|
||||
interface Identifiable {
|
||||
+ getId(): UUID
|
||||
@@ -47,7 +47,7 @@ package "fr.luc.crcore.common" {
|
||||
|
||||
' === Team domain ===
|
||||
|
||||
package "fr.luc.crcore.team" {
|
||||
package "fr.luc.crcore.features.team" {
|
||||
|
||||
enum TeamRole {
|
||||
LEADER
|
||||
|
||||
@@ -4,7 +4,7 @@ title CR-Core — Team config (class diagram, cascade per-team → global → de
|
||||
skinparam classAttributeIconSize 0
|
||||
hide empty members
|
||||
|
||||
package "fr.luc.crcore.team.config" {
|
||||
package "fr.luc.crcore.features.team.config" {
|
||||
|
||||
class "TeamSetting<T>" as TeamSetting <<final>> {
|
||||
- key: String
|
||||
@@ -60,7 +60,7 @@ package "fr.luc.crcore.team.config" {
|
||||
+ getGlobalFileName(): Optional<String>
|
||||
}
|
||||
|
||||
package "fr.luc.crcore.team.config.impl" {
|
||||
package "fr.luc.crcore.features.team.config.impl" {
|
||||
class YamlTeamConfigService {
|
||||
- plugin: JavaPlugin
|
||||
- teamRepository: TeamRepository
|
||||
@@ -77,14 +77,14 @@ package "fr.luc.crcore.team.config" {
|
||||
TeamConfigService ..> TeamSetting : reads/writes
|
||||
}
|
||||
|
||||
package "fr.luc.crcore.team" {
|
||||
package "fr.luc.crcore.features.team" {
|
||||
class Team {
|
||||
- settings: Map<String, Object>
|
||||
+ getSettings(): Map<String, Object>
|
||||
}
|
||||
}
|
||||
|
||||
package "fr.luc.crcore.team.config.gui" {
|
||||
package "fr.luc.crcore.features.team.config.gui" {
|
||||
abstract class AbstractSettingsGui {
|
||||
- rebuild() : peint la grille
|
||||
# {abstract} getCurrentValue(setting): T
|
||||
@@ -96,14 +96,14 @@ package "fr.luc.crcore.team.config.gui" {
|
||||
class TeamSettingsGui
|
||||
GlobalSettingsGui --|> AbstractSettingsGui
|
||||
TeamSettingsGui --|> AbstractSettingsGui
|
||||
AbstractSettingsGui --|> "fr.luc.crcore.gui.AbstractInventoryGui"
|
||||
AbstractSettingsGui --|> "fr.luc.crcore.util.gui.AbstractInventoryGui"
|
||||
|
||||
GlobalSettingsGui --> TeamConfigService
|
||||
TeamSettingsGui --> TeamConfigService
|
||||
TeamSettingsGui --> Team
|
||||
}
|
||||
|
||||
YamlTeamConfigService --> "fr.luc.crcore.team.TeamRepository" : persists per-team via save()
|
||||
YamlTeamConfigService --> "fr.luc.crcore.features.team.TeamRepository" : persists per-team via save()
|
||||
TeamConfigService ..> Team : reads/writes settings map
|
||||
|
||||
note bottom of YamlTeamConfigService
|
||||
|
||||
+97
-99
@@ -66,7 +66,12 @@ api-version: 1.16
|
||||
> Dans ce cas, CR-Core détecte la commande déclarée et s'y branche
|
||||
> normalement via `setExecutor` (pas d'enregistrement dynamique).
|
||||
|
||||
### Code minimal
|
||||
### Code minimal — setup modulaire
|
||||
|
||||
> ⚠️ **Important** : depuis 2026-06-10, les features (teams, players,
|
||||
> placeholders) sont **opt-in** via `CRCoreConfig.setupX()`. Une instance
|
||||
> `new CRCoreConfig()` n'active rien par défaut — il faut appeler
|
||||
> `setupAll()` ou les `setupX()` individuels.
|
||||
|
||||
```java
|
||||
public class MyGamePlugin extends JavaPlugin {
|
||||
@@ -75,13 +80,27 @@ public class MyGamePlugin extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// 1 ligne = SQLite + services + /core team ... opérationnels
|
||||
this.core = new CRCore(this).enable();
|
||||
// OPTION A — tout activer en une ligne (teams + players + placeholders)
|
||||
this.core = new CRCore(this, new CRCoreConfig().setupAll()).enable();
|
||||
|
||||
// Listener custom sur les events team
|
||||
// OPTION B — granularité, n'activer que ce qu'on veut
|
||||
// this.core = new CRCore(this, new CRCoreConfig()
|
||||
// .setupTeams()
|
||||
// .setupPlaceholders()) // pas de players
|
||||
// .enable();
|
||||
|
||||
// OPTION C — par défaut + options
|
||||
// this.core = new CRCore(this, new CRCoreConfig()
|
||||
// .withSqliteFile("mygame.db")
|
||||
// .withCommandName("game")
|
||||
// .setupTeams())
|
||||
// .enable();
|
||||
|
||||
// Listener custom sur les events team (nécessite setupTeams)
|
||||
getServer().getPluginManager().registerEvents(new MyTeamListener(), this);
|
||||
|
||||
// Table custom pour stocker des données spécifiques au jeu
|
||||
// (database util est toujours disponible)
|
||||
core.getDatabase().table("my_kills")
|
||||
.ifNotExists()
|
||||
.column("player_id", ColumnType.UUID).primaryKey()
|
||||
@@ -168,101 +187,80 @@ CitesPlugin/ # dossier IntelliJ (renommer plus t
|
||||
│ ├── decisions.md
|
||||
│ └── diagrams/*.puml
|
||||
└── src/main/java/fr/luc/crcore/
|
||||
├── CRCore.java # bootstrap orchestrator
|
||||
├── CRCoreConfig.java # config (sqlite, command name, …)
|
||||
├── common/
|
||||
│ ├── Identifiable.java
|
||||
│ ├── Named.java
|
||||
│ ├── ScoreHolder.java # contrat partagé Team + PlayerProfile
|
||||
│ ├── AbstractEntity.java
|
||||
│ └── Repository.java
|
||||
├── database/ # wrapper SQLite
|
||||
│ ├── Database.java
|
||||
│ ├── TableBuilder.java
|
||||
│ ├── ColumnType.java
|
||||
│ ├── RowMapper.java
|
||||
│ └── DatabaseException.java
|
||||
├── command/ # framework
|
||||
│ ├── Command.java (interface)
|
||||
│ ├── AbstractCommand.java # base partagée, nested sub-commands
|
||||
│ ├── BaseCommand.java # top-level Bukkit-aware
|
||||
│ ├── SubCommand.java
|
||||
│ ├── CommandContext.java
|
||||
│ ├── CommandResult.java
|
||||
│ ├── CommandException.java
|
||||
│ ├── ArgumentType.java
|
||||
│ ├── ArgumentTypes.java
|
||||
│ ├── ArgumentDef.java # package-private
|
||||
│ └── builtin/ # commandes prêtes à l'emploi
|
||||
│ ├── CoreCommand.java # /core
|
||||
│ └── team/
|
||||
│ ├── TeamGroupSubCommand.java # /core team (container)
|
||||
│ ├── TeamArgumentTypes.java # ArgumentType<Team> avec tab-complete
|
||||
│ ├── TeamCreateSubCommand.java # /core team create
|
||||
│ ├── TeamDeleteSubCommand.java # /core team delete
|
||||
│ ├── TeamAddSubCommand.java # /core team add
|
||||
│ ├── TeamRemoveSubCommand.java # /core team remove
|
||||
│ ├── TeamJoinSubCommand.java # /core team join
|
||||
│ ├── TeamLeaveSubCommand.java # /core team leave
|
||||
│ ├── TeamInfoSubCommand.java # /core team info
|
||||
│ ├── TeamListSubCommand.java # /core team list
|
||||
│ ├── TeamTransferSubCommand.java # /core team transfer
|
||||
│ ├── TeamVisibilitySubCommand.java # /core team visibility
|
||||
│ ├── TeamScoreSubCommand.java # /core team score (admin)
|
||||
│ ├── TeamTopSubCommand.java # /core team top
|
||||
│ └── TeamSetSpawnSubCommand.java # /core team setspawn
|
||||
├── message/ # service de messages YAML
|
||||
│ ├── MessagesService.java # interface (contrat public)
|
||||
│ └── impl/
|
||||
│ └── YamlMessagesService.java # impl par défaut
|
||||
├── team/ # contrats + entités au top
|
||||
│ ├── Team.java # entité
|
||||
│ ├── TeamMember.java # entité
|
||||
│ ├── TeamRole.java # enum
|
||||
│ ├── TeamColor.java # enum
|
||||
│ ├── TeamVisibility.java # enum
|
||||
│ ├── TeamRanking.java # value
|
||||
│ ├── TeamService.java # interface
|
||||
│ ├── TeamRepository.java # interface
|
||||
│ ├── event/ # Bukkit events team
|
||||
│ │ ├── TeamEvent.java # base
|
||||
│ │ ├── TeamCreateEvent.java
|
||||
│ │ ├── TeamDissolveEvent.java
|
||||
│ │ ├── TeamMemberAddEvent.java
|
||||
│ │ ├── TeamMemberRemoveEvent.java
|
||||
│ │ ├── PlayerJoinTeamEvent.java
|
||||
│ │ ├── TeamLeadershipTransferEvent.java
|
||||
│ │ ├── TeamVisibilityChangeEvent.java
|
||||
│ │ ├── TeamScoreChangeEvent.java
|
||||
│ │ └── TeamSpawnPointChangeEvent.java
|
||||
│ ├── exception/ # hiérarchie d'exceptions team
|
||||
│ │ ├── TeamException.java # base
|
||||
│ │ ├── TeamAlreadyExistsException.java
|
||||
│ │ ├── TeamNotFoundException.java
|
||||
│ │ └── TeamAccessException.java
|
||||
│ └── impl/ # implémentations swappables
|
||||
│ ├── TeamServiceImpl.java # service de base
|
||||
│ ├── BukkitEventFiringTeamServiceImpl.java # impl par défaut
|
||||
│ ├── InMemoryTeamRepository.java # repo en mémoire
|
||||
│ └── SqliteTeamRepository.java # repo SQLite write-through
|
||||
└── player/ # contrats + entités au top
|
||||
├── PlayerProfile.java # entité
|
||||
├── PlayerRanking.java # value
|
||||
├── PlayerProfileService.java # interface
|
||||
├── PlayerProfileRepository.java # interface
|
||||
├── event/ # Bukkit events player
|
||||
│ ├── PlayerProfileEvent.java
|
||||
│ ├── PlayerProfileCreateEvent.java
|
||||
│ ├── PlayerProfileDeleteEvent.java
|
||||
│ └── PlayerScoreChangeEvent.java
|
||||
├── exception/
|
||||
│ ├── PlayerException.java
|
||||
│ └── PlayerProfileNotFoundException.java
|
||||
└── impl/
|
||||
├── PlayerProfileServiceImpl.java
|
||||
├── BukkitEventFiringPlayerProfileServiceImpl.java
|
||||
├── InMemoryPlayerProfileRepository.java
|
||||
└── SqlitePlayerProfileRepository.java
|
||||
├── CRCore.java # bootstrap (setupAll/setupTeams/...)
|
||||
├── CRCoreConfig.java # config builder + flags features
|
||||
├── builtin/ # commandes top-level (toutes features)
|
||||
│ ├── CoreCommand.java # /core
|
||||
│ └── CoreReloadSubCommand.java # /core reload
|
||||
├── util/ # ◆ couche util — toujours active ◆
|
||||
│ ├── common/ # abstractions partagées
|
||||
│ │ ├── Identifiable.java
|
||||
│ │ ├── Named.java
|
||||
│ │ ├── ScoreHolder.java
|
||||
│ │ ├── AbstractEntity.java
|
||||
│ │ └── Repository.java
|
||||
│ ├── database/ # wrapper SQLite générique
|
||||
│ │ ├── Database.java
|
||||
│ │ ├── TableBuilder.java
|
||||
│ │ ├── ColumnType.java
|
||||
│ │ ├── RowMapper.java
|
||||
│ │ └── DatabaseException.java
|
||||
│ ├── command/ # framework de commandes
|
||||
│ │ ├── Command.java (interface)
|
||||
│ │ ├── AbstractCommand.java
|
||||
│ │ ├── BaseCommand.java
|
||||
│ │ ├── SubCommand.java
|
||||
│ │ ├── CommandContext.java
|
||||
│ │ ├── CommandResult.java
|
||||
│ │ ├── CommandException.java
|
||||
│ │ ├── ArgumentType.java
|
||||
│ │ ├── ArgumentTypes.java
|
||||
│ │ └── ArgumentDef.java (package-private)
|
||||
│ ├── message/ # service messages YAML
|
||||
│ │ ├── MessagesService.java
|
||||
│ │ └── impl/YamlMessagesService.java
|
||||
│ ├── broadcast/ # service broadcasts YAML + listener
|
||||
│ │ ├── BroadcastService.java
|
||||
│ │ ├── BroadcastAudience.java
|
||||
│ │ ├── BroadcastContext.java
|
||||
│ │ ├── CRCoreBroadcastListener.java
|
||||
│ │ └── impl/YamlBroadcastService.java
|
||||
│ ├── gui/ # framework GUI (InventoryHolder)
|
||||
│ │ ├── AbstractInventoryGui.java
|
||||
│ │ ├── GuiClickHandler.java
|
||||
│ │ ├── GuiListener.java
|
||||
│ │ └── GuiItems.java
|
||||
│ └── placeholder/ # PAPI expansion (opt-in)
|
||||
│ └── CRCorePlaceholderExpansion.java
|
||||
└── features/ # ◆ features opt-in via setupX() ◆
|
||||
├── team/ (setupTeams())
|
||||
│ ├── Team.java, TeamMember, enums, TeamRanking
|
||||
│ ├── TeamService.java (interface)
|
||||
│ ├── TeamRepository.java (interface)
|
||||
│ ├── event/ (9 events Bukkit)
|
||||
│ ├── exception/ (4 exceptions)
|
||||
│ ├── impl/ (TeamServiceImpl, BukkitEventFiring*, InMemory*, Sqlite*)
|
||||
│ ├── config/ (settings typés)
|
||||
│ │ ├── TeamSetting.java
|
||||
│ │ ├── TeamSettings.java (registry)
|
||||
│ │ ├── TeamConfigService.java
|
||||
│ │ ├── impl/YamlTeamConfigService.java
|
||||
│ │ └── gui/ (Global + TeamSettingsGui)
|
||||
│ │ ├── AbstractSettingsGui.java
|
||||
│ │ ├── GlobalSettingsGui.java
|
||||
│ │ └── TeamSettingsGui.java
|
||||
│ └── command/ (14 sous-commandes /core team)
|
||||
│ ├── TeamGroupSubCommand.java
|
||||
│ ├── TeamArgumentTypes.java
|
||||
│ └── Team*SubCommand.java
|
||||
└── player/ (setupPlayers())
|
||||
├── PlayerProfile.java
|
||||
├── PlayerRanking.java
|
||||
├── PlayerProfileService.java (interface)
|
||||
├── PlayerProfileRepository.java (interface)
|
||||
├── event/ (3 events)
|
||||
├── exception/ (2 exceptions)
|
||||
└── impl/ (services + repositories)
|
||||
```
|
||||
|
||||
## Fichiers de config générés au premier `enable()`
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
package fr.luc.crcore;
|
||||
|
||||
import fr.luc.crcore.broadcast.BroadcastService;
|
||||
import fr.luc.crcore.broadcast.CRCoreBroadcastListener;
|
||||
import fr.luc.crcore.broadcast.impl.YamlBroadcastService;
|
||||
import fr.luc.crcore.command.builtin.CoreCommand;
|
||||
import fr.luc.crcore.database.Database;
|
||||
import fr.luc.crcore.gui.GuiListener;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.message.impl.YamlMessagesService;
|
||||
import fr.luc.crcore.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.team.config.impl.YamlTeamConfigService;
|
||||
import fr.luc.crcore.player.impl.BukkitEventFiringPlayerProfileServiceImpl;
|
||||
import fr.luc.crcore.player.impl.InMemoryPlayerProfileRepository;
|
||||
import fr.luc.crcore.player.PlayerProfileRepository;
|
||||
import fr.luc.crcore.player.PlayerProfileService;
|
||||
import fr.luc.crcore.player.impl.SqlitePlayerProfileRepository;
|
||||
import fr.luc.crcore.team.impl.BukkitEventFiringTeamServiceImpl;
|
||||
import fr.luc.crcore.team.impl.InMemoryTeamRepository;
|
||||
import fr.luc.crcore.team.impl.SqliteTeamRepository;
|
||||
import fr.luc.crcore.team.TeamRepository;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.builtin.CoreCommand;
|
||||
import fr.luc.crcore.features.player.PlayerProfileRepository;
|
||||
import fr.luc.crcore.features.player.PlayerProfileService;
|
||||
import fr.luc.crcore.features.player.impl.BukkitEventFiringPlayerProfileServiceImpl;
|
||||
import fr.luc.crcore.features.player.impl.InMemoryPlayerProfileRepository;
|
||||
import fr.luc.crcore.features.player.impl.SqlitePlayerProfileRepository;
|
||||
import fr.luc.crcore.features.team.TeamRepository;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import fr.luc.crcore.features.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.features.team.config.impl.YamlTeamConfigService;
|
||||
import fr.luc.crcore.features.team.impl.BukkitEventFiringTeamServiceImpl;
|
||||
import fr.luc.crcore.features.team.impl.InMemoryTeamRepository;
|
||||
import fr.luc.crcore.features.team.impl.SqliteTeamRepository;
|
||||
import fr.luc.crcore.util.broadcast.BroadcastService;
|
||||
import fr.luc.crcore.util.broadcast.CRCoreBroadcastListener;
|
||||
import fr.luc.crcore.util.broadcast.impl.YamlBroadcastService;
|
||||
import fr.luc.crcore.util.database.Database;
|
||||
import fr.luc.crcore.util.gui.GuiListener;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.util.message.impl.YamlMessagesService;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -35,15 +35,18 @@ import java.util.Objects;
|
||||
/**
|
||||
* Point d'entrée unique de CR-Core pour un plugin de jeu downstream.
|
||||
*
|
||||
* <p>Instanciée une fois dans {@code onEnable()}, branche en cascade :
|
||||
* <p>Instancié une fois dans {@code onEnable()}, branche en cascade :
|
||||
* <ol>
|
||||
* <li>la base SQLite (dans le dataFolder du plugin),</li>
|
||||
* <li>les repositories (SQLite ou in-memory selon {@link CRCoreConfig}),</li>
|
||||
* <li>les services team + player avec fire d'évènements Bukkit,</li>
|
||||
* <li>la commande {@code /core} avec tous ses sous-commandes par défaut.</li>
|
||||
* <li>la base SQLite (toujours, si activée),</li>
|
||||
* <li>les services <b>util</b> (messages, broadcasts, GUI) — toujours,</li>
|
||||
* <li>les <b>features</b> activées via {@link CRCoreConfig#setupTeams()},
|
||||
* {@link CRCoreConfig#setupPlayers()},
|
||||
* {@link CRCoreConfig#setupPlaceholders()} (rien par défaut),</li>
|
||||
* <li>la commande {@code /core} avec ses sous-commandes (uniquement
|
||||
* celles des features actives).</li>
|
||||
* </ol>
|
||||
*
|
||||
* <h2>Utilisation minimale côté plugin de jeu</h2>
|
||||
* <h2>Utilisation côté plugin de jeu</h2>
|
||||
* <pre>{@code
|
||||
* public class MyGamePlugin extends JavaPlugin {
|
||||
*
|
||||
@@ -51,8 +54,9 @@ import java.util.Objects;
|
||||
*
|
||||
* @Override
|
||||
* public void onEnable() {
|
||||
* this.core = new CRCore(this).enable();
|
||||
* // /core team create/delete/add/remove/join/leave/... est prêt
|
||||
* this.core = new CRCore(this,
|
||||
* new CRCoreConfig().setupAll()) // toutes les features
|
||||
* .enable();
|
||||
* }
|
||||
*
|
||||
* @Override
|
||||
@@ -62,18 +66,13 @@ import java.util.Objects;
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* <p>Le plugin de jeu doit avoir déclaré la commande dans son {@code plugin.yml} :
|
||||
* <pre>{@code
|
||||
* commands:
|
||||
* core:
|
||||
* description: Commandes CR-Core
|
||||
* }</pre>
|
||||
* <p>Voir {@link CRCoreConfig} pour activer les features granulairement.
|
||||
*
|
||||
* <h2>Override</h2>
|
||||
* Tout est accessible via les getters : {@link #getTeamService()},
|
||||
* {@link #getCoreCommand()}, {@link #getDatabase()}, etc. Pour remplacer une
|
||||
* sous-commande, voir {@link CoreCommand}. Pour remplacer un service complet,
|
||||
* sous-classer {@code CRCore} et override {@link #buildTeamService}.
|
||||
* Tout est accessible via les getters (qui lèvent
|
||||
* {@link IllegalStateException} si la feature n'est pas activée). Pour
|
||||
* remplacer un service, sous-classer {@code CRCore} et override
|
||||
* {@link #buildTeamService}, {@link #buildPlayerProfileService}, etc.
|
||||
*/
|
||||
public class CRCore {
|
||||
|
||||
@@ -81,17 +80,21 @@ public class CRCore {
|
||||
private final CRCoreConfig config;
|
||||
|
||||
private Database database;
|
||||
private TeamRepository teamRepository;
|
||||
private TeamService teamService;
|
||||
private PlayerProfileRepository playerProfileRepository;
|
||||
private PlayerProfileService playerProfileService;
|
||||
// Util — toujours initialisés
|
||||
private MessagesService messages;
|
||||
private BroadcastService broadcasts;
|
||||
// Features team
|
||||
private TeamRepository teamRepository;
|
||||
private TeamService teamService;
|
||||
private TeamConfigService teamConfig;
|
||||
// Features player
|
||||
private PlayerProfileRepository playerProfileRepository;
|
||||
private PlayerProfileService playerProfileService;
|
||||
// Command routing
|
||||
private CoreCommand coreCommand;
|
||||
private boolean enabled = false;
|
||||
|
||||
/** Construit CR-Core avec la config par défaut (SQLite activée, commande "core"). */
|
||||
/** Construit CR-Core avec la config par défaut (rien d'activé — opt-in via setupX()). */
|
||||
public CRCore(JavaPlugin plugin) {
|
||||
this(plugin, new CRCoreConfig());
|
||||
}
|
||||
@@ -102,56 +105,68 @@ public class CRCore {
|
||||
}
|
||||
|
||||
/**
|
||||
* Branche tout : ouvre la DB, instancie les services, enregistre la
|
||||
* commande. Idempotent : un second appel est no-op.
|
||||
* Branche tout selon la config. Idempotent : un second appel est no-op.
|
||||
*
|
||||
* @return {@code this} pour chaîner.
|
||||
*/
|
||||
public CRCore enable() {
|
||||
if (enabled) return this;
|
||||
|
||||
// ---- 1. Database (util, toujours si setupAll/X) ----
|
||||
if (config.isSqliteEnabled()) {
|
||||
File dbFile = new File(plugin.getDataFolder(), config.getSqliteFilename());
|
||||
if (!dbFile.getParentFile().exists() && !dbFile.getParentFile().mkdirs()) {
|
||||
plugin.getLogger().warning("Impossible de créer le dataFolder : " + dbFile.getParentFile());
|
||||
}
|
||||
this.database = new Database(dbFile);
|
||||
this.teamRepository = new SqliteTeamRepository(database);
|
||||
this.playerProfileRepository = new SqlitePlayerProfileRepository(database);
|
||||
} else {
|
||||
this.teamRepository = new InMemoryTeamRepository();
|
||||
this.playerProfileRepository = new InMemoryPlayerProfileRepository();
|
||||
}
|
||||
|
||||
this.teamService = buildTeamService(teamRepository);
|
||||
this.playerProfileService = buildPlayerProfileService(playerProfileRepository);
|
||||
|
||||
// ---- 2. Util services (toujours) ----
|
||||
this.messages = buildMessagesService();
|
||||
this.broadcasts = buildBroadcastService(messages);
|
||||
this.teamConfig = buildTeamConfigService(teamRepository);
|
||||
|
||||
// Listeners Bukkit : broadcasts (events CR-Core) + GUI (inventory clicks/close).
|
||||
// ---- 3. Features (opt-in) ----
|
||||
if (config.isTeamsEnabled()) {
|
||||
this.teamRepository = (database != null)
|
||||
? new SqliteTeamRepository(database)
|
||||
: new InMemoryTeamRepository();
|
||||
this.teamService = buildTeamService(teamRepository);
|
||||
this.teamConfig = buildTeamConfigService(teamRepository);
|
||||
}
|
||||
if (config.isPlayersEnabled()) {
|
||||
this.playerProfileRepository = (database != null)
|
||||
? new SqlitePlayerProfileRepository(database)
|
||||
: new InMemoryPlayerProfileRepository();
|
||||
this.playerProfileService = buildPlayerProfileService(playerProfileRepository);
|
||||
}
|
||||
|
||||
// ---- 4. Listeners Bukkit ----
|
||||
// Broadcast listener : écoute les events team + player. S'il n'y a aucune
|
||||
// feature qui les tire, il sera idle — pas de mal.
|
||||
new CRCoreBroadcastListener(broadcasts).registerOn(plugin);
|
||||
// GUI listener : toujours, le framework GUI est util.
|
||||
new GuiListener().registerOn(plugin);
|
||||
|
||||
this.coreCommand = buildCoreCommand(teamService, playerProfileService, messages, broadcasts, teamConfig);
|
||||
// ---- 5. Command routing ----
|
||||
this.coreCommand = buildCoreCommand();
|
||||
registerCommand();
|
||||
|
||||
registerPlaceholderHook();
|
||||
// ---- 6. PlaceholderAPI (opt-in + conditionnel PAPI installé) ----
|
||||
if (config.isPlaceholdersEnabled()) {
|
||||
registerPlaceholderHook();
|
||||
}
|
||||
|
||||
plugin.getLogger().info("CR-Core activé.");
|
||||
plugin.getLogger().info("CR-Core activé"
|
||||
+ " (teams=" + config.isTeamsEnabled()
|
||||
+ ", players=" + config.isPlayersEnabled()
|
||||
+ ", placeholders=" + config.isPlaceholdersEnabled() + ").");
|
||||
enabled = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistre l'expansion PlaceholderAPI {@code %crcore_*%} si le plugin
|
||||
* PAPI est installé sur le serveur. Si absent, no-op silencieux — la
|
||||
* lib reste fonctionnelle sans.
|
||||
*
|
||||
* <p>Le chargement de la classe d'expansion est différé via une indirection
|
||||
* (méthode {@code doRegisterPlaceholderHook}) pour que le bytecode
|
||||
* référençant {@code me.clip.placeholderapi.*} ne soit pas vérifié si
|
||||
* PAPI n'est pas présent.
|
||||
* Enregistre l'expansion PlaceholderAPI {@code %crcore_*%} si PAPI est
|
||||
* installé. No-op silencieux sinon.
|
||||
*/
|
||||
protected void registerPlaceholderHook() {
|
||||
if (plugin.getServer().getPluginManager().getPlugin("PlaceholderAPI") == null) {
|
||||
@@ -166,9 +181,9 @@ public class CRCore {
|
||||
}
|
||||
}
|
||||
|
||||
/** Indirection pour différer le chargement des classes PAPI (cf. {@link #registerPlaceholderHook}). */
|
||||
/** Indirection pour différer le chargement des classes PAPI. */
|
||||
private void doRegisterPlaceholderHook() {
|
||||
new fr.luc.crcore.placeholder.CRCorePlaceholderExpansion(
|
||||
new fr.luc.crcore.util.placeholder.CRCorePlaceholderExpansion(
|
||||
teamService, playerProfileService, plugin.getDescription().getVersion()
|
||||
).register();
|
||||
}
|
||||
@@ -189,53 +204,38 @@ public class CRCore {
|
||||
|
||||
// ---- Override points ----
|
||||
|
||||
/** Construit le {@link TeamService}. Override pour utiliser une impl custom. */
|
||||
protected TeamService buildTeamService(TeamRepository repository) {
|
||||
return new BukkitEventFiringTeamServiceImpl(plugin, repository);
|
||||
}
|
||||
|
||||
/** Construit le {@link PlayerProfileService}. Override pour une impl custom. */
|
||||
protected PlayerProfileService buildPlayerProfileService(PlayerProfileRepository repository) {
|
||||
return new BukkitEventFiringPlayerProfileServiceImpl(plugin, repository);
|
||||
}
|
||||
|
||||
/** Construit le {@link CoreCommand}. Override pour ajouter des groupes top-level. */
|
||||
protected CoreCommand buildCoreCommand(TeamService teamService,
|
||||
PlayerProfileService playerProfileService,
|
||||
MessagesService messages,
|
||||
BroadcastService broadcasts,
|
||||
TeamConfigService teamConfig) {
|
||||
return new CoreCommand(teamService, playerProfileService, messages, broadcasts, teamConfig);
|
||||
}
|
||||
|
||||
/** Construit le {@link TeamConfigService}. Override pour utiliser une impl custom. */
|
||||
protected TeamConfigService buildTeamConfigService(TeamRepository repository) {
|
||||
return new YamlTeamConfigService(plugin, repository);
|
||||
}
|
||||
|
||||
/** Construit le {@link MessagesService}. Override pour utiliser une impl custom. */
|
||||
protected MessagesService buildMessagesService() {
|
||||
return new YamlMessagesService(plugin);
|
||||
}
|
||||
|
||||
/** Construit le {@link BroadcastService}. Override pour utiliser une impl custom. */
|
||||
protected BroadcastService buildBroadcastService(MessagesService messages) {
|
||||
return new YamlBroadcastService(plugin, messages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistre {@link #coreCommand} sous le nom configuré, avec fallback
|
||||
* dynamique. Stratégie :
|
||||
* <ol>
|
||||
* <li>Si la commande est déclarée dans le {@code plugin.yml} du plugin
|
||||
* hôte ({@code plugin.getCommand(name)} non null), on s'y branche
|
||||
* classiquement via {@code setExecutor} / {@code setTabCompleter}.</li>
|
||||
* <li>Sinon, on l'enregistre <b>dynamiquement</b> via le
|
||||
* {@link CommandMap} interne du serveur (accédé par réflexion sur
|
||||
* le champ {@code commandMap} de {@code CraftServer}). Le plugin
|
||||
* hôte n'a alors rien à mettre dans son {@code plugin.yml}.</li>
|
||||
* </ol>
|
||||
*/
|
||||
protected TeamConfigService buildTeamConfigService(TeamRepository repository) {
|
||||
return new YamlTeamConfigService(plugin, repository);
|
||||
}
|
||||
|
||||
/** Construit le {@link CoreCommand} avec les services des features activées. */
|
||||
protected CoreCommand buildCoreCommand() {
|
||||
return new CoreCommand(
|
||||
config.isTeamsEnabled() ? teamService : null,
|
||||
config.isPlayersEnabled() ? playerProfileService : null,
|
||||
messages,
|
||||
broadcasts,
|
||||
config.isTeamsEnabled() ? teamConfig : null);
|
||||
}
|
||||
|
||||
// ---- Command registration (plugin.yml ou CommandMap dynamique) ----
|
||||
|
||||
private void registerCommand() {
|
||||
String name = config.getCommandName();
|
||||
PluginCommand cmd = plugin.getCommand(name);
|
||||
@@ -247,12 +247,6 @@ public class CRCore {
|
||||
registerDynamicCommand(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistre la commande sans entrée plugin.yml en passant par le
|
||||
* {@link CommandMap} interne du serveur. Wrappe le {@link CoreCommand}
|
||||
* dans une {@link org.bukkit.command.Command} anonyme qui délègue à
|
||||
* {@code onCommand} / {@code onTabComplete}.
|
||||
*/
|
||||
private void registerDynamicCommand(String name) {
|
||||
try {
|
||||
CommandMap commandMap = resolveCommandMap();
|
||||
@@ -278,10 +272,6 @@ public class CRCore {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère le {@link CommandMap} interne du serveur via réflexion sur
|
||||
* {@code CraftServer.commandMap}. Stable sur Paper 1.16.5.
|
||||
*/
|
||||
private CommandMap resolveCommandMap() throws ReflectiveOperationException {
|
||||
Field field = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||
field.setAccessible(true);
|
||||
@@ -292,17 +282,64 @@ public class CRCore {
|
||||
|
||||
public JavaPlugin getPlugin() { return plugin; }
|
||||
public CRCoreConfig getConfig() { return config; }
|
||||
public Database getDatabase() { return database; }
|
||||
public TeamRepository getTeamRepository() { return teamRepository; }
|
||||
public TeamService getTeamService() { return teamService; }
|
||||
public PlayerProfileRepository getPlayerProfileRepository() { return playerProfileRepository; }
|
||||
public PlayerProfileService getPlayerProfileService() { return playerProfileService; }
|
||||
|
||||
public Database getDatabase() {
|
||||
if (database == null) {
|
||||
throw new IllegalStateException("Database is disabled (config.withInMemoryStorage()).");
|
||||
}
|
||||
return database;
|
||||
}
|
||||
|
||||
public MessagesService getMessages() { return messages; }
|
||||
public MessagesService messages() { return messages; }
|
||||
public BroadcastService getBroadcasts() { return broadcasts; }
|
||||
public BroadcastService broadcasts() { return broadcasts; }
|
||||
public TeamConfigService getTeamConfig() { return teamConfig; }
|
||||
public TeamConfigService teamConfig() { return teamConfig; }
|
||||
|
||||
public TeamRepository getTeamRepository() {
|
||||
requireTeamsEnabled();
|
||||
return teamRepository;
|
||||
}
|
||||
|
||||
public TeamService getTeamService() {
|
||||
requireTeamsEnabled();
|
||||
return teamService;
|
||||
}
|
||||
|
||||
public TeamConfigService getTeamConfig() {
|
||||
requireTeamsEnabled();
|
||||
return teamConfig;
|
||||
}
|
||||
|
||||
public TeamConfigService teamConfig() {
|
||||
return getTeamConfig();
|
||||
}
|
||||
|
||||
public PlayerProfileRepository getPlayerProfileRepository() {
|
||||
requirePlayersEnabled();
|
||||
return playerProfileRepository;
|
||||
}
|
||||
|
||||
public PlayerProfileService getPlayerProfileService() {
|
||||
requirePlayersEnabled();
|
||||
return playerProfileService;
|
||||
}
|
||||
|
||||
public CoreCommand getCoreCommand() { return coreCommand; }
|
||||
public boolean isEnabled() { return enabled; }
|
||||
|
||||
// ---- Guards ----
|
||||
|
||||
private void requireTeamsEnabled() {
|
||||
if (!config.isTeamsEnabled()) {
|
||||
throw new IllegalStateException(
|
||||
"Teams feature is not enabled — appelez CRCoreConfig.setupTeams() avant enable().");
|
||||
}
|
||||
}
|
||||
|
||||
private void requirePlayersEnabled() {
|
||||
if (!config.isPlayersEnabled()) {
|
||||
throw new IllegalStateException(
|
||||
"Players feature is not enabled — appelez CRCoreConfig.setupPlayers() avant enable().");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,47 @@
|
||||
package fr.luc.crcore;
|
||||
|
||||
/**
|
||||
* Configuration de {@link CRCore} fournie au constructeur. API builder : on
|
||||
* chaîne les {@code with...} pour modifier les valeurs par défaut.
|
||||
* Configuration de {@link CRCore} fournie au constructeur. API builder
|
||||
* fluide.
|
||||
*
|
||||
* <h2>Modèle modulaire</h2>
|
||||
*
|
||||
* <p>Les <b>features</b> CR-Core (teams, players, placeholders PAPI) sont
|
||||
* <b>opt-in</b> : par défaut <em>aucune</em> n'est activée, seule la couche
|
||||
* util (messages, broadcasts, GUI framework, command framework, database)
|
||||
* est chargée. Tu actives explicitement ce dont tu as besoin :
|
||||
*
|
||||
* <pre>{@code
|
||||
* // Tout activer en une ligne :
|
||||
* new CRCore(this, new CRCoreConfig().setupAll()).enable();
|
||||
*
|
||||
* // Ou granularité :
|
||||
* new CRCore(this, new CRCoreConfig()
|
||||
* .setupTeams()
|
||||
* .setupPlaceholders() // sans players
|
||||
* .withCommandName("game"))
|
||||
* .enable();
|
||||
*
|
||||
* // Tout par défaut + setups :
|
||||
* new CRCore(this, new CRCoreConfig()
|
||||
* .withSqliteFile("mydata.db")
|
||||
* .withCommandName("game"))
|
||||
* .setupAll())
|
||||
* .enable();
|
||||
* }</pre>
|
||||
*
|
||||
* <p>Valeurs par défaut :
|
||||
* <h2>Comportement quand une feature n'est pas activée</h2>
|
||||
*
|
||||
* <p>Le getter correspondant sur {@link CRCore} (ex. {@code core.getTeamService()})
|
||||
* lève {@link IllegalStateException} avec un message explicite, et la
|
||||
* commande built-in n'est pas enregistrée (ex. pas de {@code /core team}
|
||||
* si {@code setupTeams()} n'a pas été appelé).
|
||||
*
|
||||
* <h2>Valeurs par défaut</h2>
|
||||
*
|
||||
* <ul>
|
||||
* <li>SQLite activé, fichier {@code crcore.db} dans le dataFolder du plugin</li>
|
||||
* <li>SQLite activé, fichier {@code crcore.db}</li>
|
||||
* <li>Commande Bukkit racine : {@code core}</li>
|
||||
* <li>Aucune feature activée (opt-in via {@code setupX()})</li>
|
||||
* </ul>
|
||||
*/
|
||||
public class CRCoreConfig {
|
||||
@@ -23,6 +50,13 @@ public class CRCoreConfig {
|
||||
private String sqliteFilename = "crcore.db";
|
||||
private String commandName = "core";
|
||||
|
||||
// ---- Features (opt-in) ----
|
||||
private boolean teamsEnabled = false;
|
||||
private boolean playersEnabled = false;
|
||||
private boolean placeholdersEnabled = false;
|
||||
|
||||
// ---- Util / infra setters ----
|
||||
|
||||
/** Désactive SQLite — toutes les données vivent en mémoire (perdues au reload/stop). */
|
||||
public CRCoreConfig withInMemoryStorage() {
|
||||
this.sqliteEnabled = false;
|
||||
@@ -38,14 +72,61 @@ public class CRCoreConfig {
|
||||
|
||||
/**
|
||||
* Change le nom de la commande Bukkit racine. Doit matcher l'entrée du
|
||||
* {@code commands:} dans le {@code plugin.yml} du plugin de jeu.
|
||||
* {@code commands:} dans le {@code plugin.yml} du plugin de jeu (ou
|
||||
* passe par l'enregistrement dynamique de CR-Core si la commande n'est
|
||||
* pas déclarée).
|
||||
*/
|
||||
public CRCoreConfig withCommandName(String commandName) {
|
||||
this.commandName = commandName;
|
||||
return this;
|
||||
}
|
||||
|
||||
// ---- Feature setups (opt-in) ----
|
||||
|
||||
/**
|
||||
* Active la feature <b>team</b> : repositories, service, config + GUI,
|
||||
* sous-commandes {@code /core team ...}. Tire les events Bukkit
|
||||
* correspondants.
|
||||
*/
|
||||
public CRCoreConfig setupTeams() {
|
||||
this.teamsEnabled = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Active la feature <b>player</b> : repository et service de profil
|
||||
* joueur (scores nommés, classements individuels). Tire les events
|
||||
* Bukkit player.
|
||||
*/
|
||||
public CRCoreConfig setupPlayers() {
|
||||
this.playersEnabled = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Active l'intégration <b>PlaceholderAPI</b>. La hook ne sera réellement
|
||||
* enregistrée que si PAPI est installé sur le serveur. Nécessite
|
||||
* {@link #setupTeams()} et/ou {@link #setupPlayers()} pour les
|
||||
* placeholders correspondants — sinon les placeholders manquants
|
||||
* renvoient simplement vide.
|
||||
*/
|
||||
public CRCoreConfig setupPlaceholders() {
|
||||
this.placeholdersEnabled = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Active toutes les features en une fois. */
|
||||
public CRCoreConfig setupAll() {
|
||||
return setupTeams().setupPlayers().setupPlaceholders();
|
||||
}
|
||||
|
||||
// ---- Getters ----
|
||||
|
||||
public boolean isSqliteEnabled() { return sqliteEnabled; }
|
||||
public String getSqliteFilename() { return sqliteFilename; }
|
||||
public String getCommandName() { return commandName; }
|
||||
|
||||
public boolean isTeamsEnabled() { return teamsEnabled; }
|
||||
public boolean isPlayersEnabled() { return playersEnabled; }
|
||||
public boolean isPlaceholdersEnabled() { return placeholdersEnabled; }
|
||||
}
|
||||
|
||||
+27
-18
@@ -1,20 +1,27 @@
|
||||
package fr.luc.crcore.command.builtin;
|
||||
package fr.luc.crcore.builtin;
|
||||
|
||||
import fr.luc.crcore.broadcast.BroadcastService;
|
||||
import fr.luc.crcore.command.BaseCommand;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.builtin.team.TeamGroupSubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.player.PlayerProfileService;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.features.player.PlayerProfileService;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import fr.luc.crcore.features.team.command.TeamGroupSubCommand;
|
||||
import fr.luc.crcore.features.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.util.broadcast.BroadcastService;
|
||||
import fr.luc.crcore.util.command.BaseCommand;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Commande racine {@code /core}. Container des groupes par défaut + la
|
||||
* sous-commande {@link CoreReloadSubCommand} ({@code /core reload}).
|
||||
* Commande racine {@code /core}. Container des features actives.
|
||||
*
|
||||
* <p>Les services {@code teamService}, {@code playerProfileService} et
|
||||
* {@code teamConfig} peuvent être {@code null} si la feature correspondante
|
||||
* n'a pas été activée via {@link fr.luc.crcore.CRCoreConfig#setupTeams()}
|
||||
* etc. — la sous-commande associée n'est alors simplement pas enregistrée.
|
||||
*
|
||||
* <p>{@code /core reload} et le rendu des messages communs (no-permission,
|
||||
* etc.) restent toujours disponibles car ils ne dépendent que d'util.
|
||||
*/
|
||||
public class CoreCommand extends BaseCommand {
|
||||
|
||||
@@ -30,25 +37,27 @@ public class CoreCommand extends BaseCommand {
|
||||
BroadcastService broadcasts,
|
||||
TeamConfigService teamConfig) {
|
||||
super("core");
|
||||
this.teamService = Objects.requireNonNull(teamService, "teamService");
|
||||
this.playerProfileService = Objects.requireNonNull(playerProfileService, "playerProfileService");
|
||||
// Les services de features peuvent être null (feature off).
|
||||
this.teamService = teamService;
|
||||
this.playerProfileService = playerProfileService;
|
||||
this.messages = Objects.requireNonNull(messages, "messages");
|
||||
this.broadcasts = Objects.requireNonNull(broadcasts, "broadcasts");
|
||||
this.teamConfig = Objects.requireNonNull(teamConfig, "teamConfig");
|
||||
this.teamConfig = teamConfig;
|
||||
description("Commandes du noyau CR-Core");
|
||||
registerDefaults();
|
||||
}
|
||||
|
||||
/** Enregistre les groupes par défaut + la sous-commande reload. */
|
||||
/** Enregistre les sous-commandes des features activées + reload. */
|
||||
protected void registerDefaults() {
|
||||
addSubCommand(new TeamGroupSubCommand(teamService, messages, teamConfig));
|
||||
if (teamService != null && teamConfig != null) {
|
||||
addSubCommand(new TeamGroupSubCommand(teamService, messages, teamConfig));
|
||||
}
|
||||
addSubCommand(new CoreReloadSubCommand(messages, broadcasts, teamConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* Override de {@link BaseCommand#handleResult} pour utiliser
|
||||
* {@link MessagesService} sur les cas génériques (no-permission,
|
||||
* player-only, etc.) au lieu des strings hardcodés du framework.
|
||||
* {@link MessagesService} sur les cas génériques.
|
||||
*/
|
||||
@Override
|
||||
protected void handleResult(CommandSender sender, CommandResult result) {
|
||||
+10
-9
@@ -1,11 +1,11 @@
|
||||
package fr.luc.crcore.command.builtin;
|
||||
package fr.luc.crcore.builtin;
|
||||
|
||||
import fr.luc.crcore.broadcast.BroadcastService;
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.util.broadcast.BroadcastService;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.config.TeamConfigService;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -28,7 +28,8 @@ public class CoreReloadSubCommand extends SubCommand {
|
||||
super("reload");
|
||||
this.messages = Objects.requireNonNull(messages, "messages");
|
||||
this.broadcasts = Objects.requireNonNull(broadcasts, "broadcasts");
|
||||
this.teamConfig = Objects.requireNonNull(teamConfig, "teamConfig");
|
||||
// teamConfig peut être null si la feature teams n'est pas activée.
|
||||
this.teamConfig = teamConfig;
|
||||
description("Recharger les fichiers messages, broadcasts et team-config");
|
||||
permission("crcore.reload");
|
||||
}
|
||||
@@ -37,7 +38,7 @@ public class CoreReloadSubCommand extends SubCommand {
|
||||
public CommandResult execute(CommandContext ctx) {
|
||||
messages.reload();
|
||||
broadcasts.reload();
|
||||
teamConfig.reload();
|
||||
if (teamConfig != null) teamConfig.reload();
|
||||
return CommandResult.success(messages.get("common.reload.success"));
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package fr.luc.crcore.player;
|
||||
package fr.luc.crcore.features.player;
|
||||
|
||||
import fr.luc.crcore.common.AbstractEntity;
|
||||
import fr.luc.crcore.common.ScoreHolder;
|
||||
import fr.luc.crcore.util.common.AbstractEntity;
|
||||
import fr.luc.crcore.util.common.ScoreHolder;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -0,0 +1,6 @@
|
||||
package fr.luc.crcore.features.player;
|
||||
|
||||
import fr.luc.crcore.util.common.Repository;
|
||||
|
||||
public interface PlayerProfileRepository extends Repository<PlayerProfile> {
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.player;
|
||||
package fr.luc.crcore.features.player;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.player;
|
||||
package fr.luc.crcore.features.player;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.player.event;
|
||||
package fr.luc.crcore.features.player.event;
|
||||
|
||||
import fr.luc.crcore.player.PlayerProfile;
|
||||
import fr.luc.crcore.features.player.PlayerProfile;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/** Déclenché juste après la création d'un profil (lazy ou explicite). */
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.player.event;
|
||||
package fr.luc.crcore.features.player.event;
|
||||
|
||||
import fr.luc.crcore.player.PlayerProfile;
|
||||
import fr.luc.crcore.features.player.PlayerProfile;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/** Déclenché juste après la suppression d'un profil. */
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.player.event;
|
||||
package fr.luc.crcore.features.player.event;
|
||||
|
||||
import fr.luc.crcore.player.PlayerProfile;
|
||||
import fr.luc.crcore.features.player.PlayerProfile;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
import java.util.Objects;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.player.event;
|
||||
package fr.luc.crcore.features.player.event;
|
||||
|
||||
import fr.luc.crcore.player.PlayerProfile;
|
||||
import fr.luc.crcore.features.player.PlayerProfile;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.Objects;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.player.exception;
|
||||
package fr.luc.crcore.features.player.exception;
|
||||
|
||||
public class PlayerException extends RuntimeException {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.player.exception;
|
||||
package fr.luc.crcore.features.player.exception;
|
||||
|
||||
public class PlayerProfileNotFoundException extends PlayerException {
|
||||
|
||||
+10
-10
@@ -1,14 +1,14 @@
|
||||
package fr.luc.crcore.player.impl;
|
||||
import fr.luc.crcore.player.exception.PlayerProfileNotFoundException;
|
||||
import fr.luc.crcore.player.exception.PlayerException;
|
||||
import fr.luc.crcore.player.PlayerProfileRepository;
|
||||
import fr.luc.crcore.player.PlayerProfileService;
|
||||
import fr.luc.crcore.player.PlayerRanking;
|
||||
import fr.luc.crcore.player.PlayerProfile;
|
||||
package fr.luc.crcore.features.player.impl;
|
||||
import fr.luc.crcore.features.player.exception.PlayerProfileNotFoundException;
|
||||
import fr.luc.crcore.features.player.exception.PlayerException;
|
||||
import fr.luc.crcore.features.player.PlayerProfileRepository;
|
||||
import fr.luc.crcore.features.player.PlayerProfileService;
|
||||
import fr.luc.crcore.features.player.PlayerRanking;
|
||||
import fr.luc.crcore.features.player.PlayerProfile;
|
||||
|
||||
import fr.luc.crcore.player.event.PlayerProfileCreateEvent;
|
||||
import fr.luc.crcore.player.event.PlayerProfileDeleteEvent;
|
||||
import fr.luc.crcore.player.event.PlayerScoreChangeEvent;
|
||||
import fr.luc.crcore.features.player.event.PlayerProfileCreateEvent;
|
||||
import fr.luc.crcore.features.player.event.PlayerProfileDeleteEvent;
|
||||
import fr.luc.crcore.features.player.event.PlayerScoreChangeEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
+7
-7
@@ -1,10 +1,10 @@
|
||||
package fr.luc.crcore.player.impl;
|
||||
import fr.luc.crcore.player.exception.PlayerProfileNotFoundException;
|
||||
import fr.luc.crcore.player.exception.PlayerException;
|
||||
import fr.luc.crcore.player.PlayerProfileRepository;
|
||||
import fr.luc.crcore.player.PlayerProfileService;
|
||||
import fr.luc.crcore.player.PlayerRanking;
|
||||
import fr.luc.crcore.player.PlayerProfile;
|
||||
package fr.luc.crcore.features.player.impl;
|
||||
import fr.luc.crcore.features.player.exception.PlayerProfileNotFoundException;
|
||||
import fr.luc.crcore.features.player.exception.PlayerException;
|
||||
import fr.luc.crcore.features.player.PlayerProfileRepository;
|
||||
import fr.luc.crcore.features.player.PlayerProfileService;
|
||||
import fr.luc.crcore.features.player.PlayerRanking;
|
||||
import fr.luc.crcore.features.player.PlayerProfile;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
+7
-7
@@ -1,10 +1,10 @@
|
||||
package fr.luc.crcore.player.impl;
|
||||
import fr.luc.crcore.player.exception.PlayerProfileNotFoundException;
|
||||
import fr.luc.crcore.player.exception.PlayerException;
|
||||
import fr.luc.crcore.player.PlayerProfileRepository;
|
||||
import fr.luc.crcore.player.PlayerProfileService;
|
||||
import fr.luc.crcore.player.PlayerRanking;
|
||||
import fr.luc.crcore.player.PlayerProfile;
|
||||
package fr.luc.crcore.features.player.impl;
|
||||
import fr.luc.crcore.features.player.exception.PlayerProfileNotFoundException;
|
||||
import fr.luc.crcore.features.player.exception.PlayerException;
|
||||
import fr.luc.crcore.features.player.PlayerProfileRepository;
|
||||
import fr.luc.crcore.features.player.PlayerProfileService;
|
||||
import fr.luc.crcore.features.player.PlayerRanking;
|
||||
import fr.luc.crcore.features.player.PlayerProfile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
+10
-10
@@ -1,13 +1,13 @@
|
||||
package fr.luc.crcore.player.impl;
|
||||
import fr.luc.crcore.player.exception.PlayerProfileNotFoundException;
|
||||
import fr.luc.crcore.player.exception.PlayerException;
|
||||
import fr.luc.crcore.player.PlayerProfileRepository;
|
||||
import fr.luc.crcore.player.PlayerProfileService;
|
||||
import fr.luc.crcore.player.PlayerRanking;
|
||||
import fr.luc.crcore.player.PlayerProfile;
|
||||
package fr.luc.crcore.features.player.impl;
|
||||
import fr.luc.crcore.features.player.exception.PlayerProfileNotFoundException;
|
||||
import fr.luc.crcore.features.player.exception.PlayerException;
|
||||
import fr.luc.crcore.features.player.PlayerProfileRepository;
|
||||
import fr.luc.crcore.features.player.PlayerProfileService;
|
||||
import fr.luc.crcore.features.player.PlayerRanking;
|
||||
import fr.luc.crcore.features.player.PlayerProfile;
|
||||
|
||||
import fr.luc.crcore.database.ColumnType;
|
||||
import fr.luc.crcore.database.Database;
|
||||
import fr.luc.crcore.util.database.ColumnType;
|
||||
import fr.luc.crcore.util.database.Database;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
@@ -15,7 +15,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Implémentation {@link PlayerProfileRepository} adossée à SQLite.
|
||||
*
|
||||
* <p>Mêmes principes que {@link fr.luc.crcore.team.SqliteTeamRepository} :
|
||||
* <p>Mêmes principes que {@link fr.luc.crcore.features.team.SqliteTeamRepository} :
|
||||
* cache mémoire en write-through, schéma créé à l'init, état rechargé depuis
|
||||
* la DB au constructeur.
|
||||
*
|
||||
+6
-6
@@ -1,8 +1,8 @@
|
||||
package fr.luc.crcore.team;
|
||||
package fr.luc.crcore.features.team;
|
||||
|
||||
import fr.luc.crcore.common.AbstractEntity;
|
||||
import fr.luc.crcore.common.Named;
|
||||
import fr.luc.crcore.common.ScoreHolder;
|
||||
import fr.luc.crcore.util.common.AbstractEntity;
|
||||
import fr.luc.crcore.util.common.Named;
|
||||
import fr.luc.crcore.util.common.ScoreHolder;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -79,11 +79,11 @@ public class Team extends AbstractEntity implements Named, ScoreHolder {
|
||||
|
||||
/**
|
||||
* Map mutable des overrides per-team de settings. Clé = nom du
|
||||
* {@link fr.luc.crcore.team.config.TeamSetting}, valeur = forme
|
||||
* {@link fr.luc.crcore.features.team.config.TeamSetting}, valeur = forme
|
||||
* sérialisable (Boolean, Integer, String, …).
|
||||
*
|
||||
* <p>Lecture / modification typée recommandée via
|
||||
* {@link fr.luc.crcore.team.config.TeamConfigService}, qui gère la
|
||||
* {@link fr.luc.crcore.features.team.config.TeamConfigService}, qui gère la
|
||||
* cascade per-team → global → default et persiste les écritures.
|
||||
*/
|
||||
public Map<String, Object> getSettings() {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.team;
|
||||
package fr.luc.crcore.features.team;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.team;
|
||||
package fr.luc.crcore.features.team;
|
||||
|
||||
import fr.luc.crcore.common.AbstractEntity;
|
||||
import fr.luc.crcore.util.common.AbstractEntity;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.team;
|
||||
package fr.luc.crcore.features.team;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.team;
|
||||
package fr.luc.crcore.features.team;
|
||||
|
||||
import fr.luc.crcore.common.Repository;
|
||||
import fr.luc.crcore.util.common.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.team;
|
||||
package fr.luc.crcore.features.team;
|
||||
|
||||
public enum TeamRole {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.team;
|
||||
package fr.luc.crcore.features.team;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.team;
|
||||
package fr.luc.crcore.features.team;
|
||||
|
||||
public enum TeamVisibility {
|
||||
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.ArgumentTypes;
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.ArgumentTypes;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
+5
-5
@@ -1,8 +1,8 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.ArgumentType;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.ArgumentType;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.List;
|
||||
@@ -30,7 +30,7 @@ public final class TeamArgumentTypes {
|
||||
@Override
|
||||
public Team parse(String input) {
|
||||
return service.getTeamByName(input).orElseThrow(() ->
|
||||
new fr.luc.crcore.command.CommandException(
|
||||
new fr.luc.crcore.util.command.CommandException(
|
||||
"Aucune équipe trouvée : " + input));
|
||||
}
|
||||
|
||||
+11
-11
@@ -1,15 +1,15 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.ArgumentTypes;
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamColor;
|
||||
import fr.luc.crcore.team.exception.TeamException;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.team.TeamVisibility;
|
||||
import fr.luc.crcore.util.command.ArgumentTypes;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamColor;
|
||||
import fr.luc.crcore.features.team.exception.TeamException;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import fr.luc.crcore.features.team.TeamVisibility;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import fr.luc.crcore.features.team.config.TeamConfigService;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.exception.TeamException;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.exception.TeamException;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.ArgumentTypes;
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.ArgumentTypes;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.ArgumentTypes;
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.ArgumentTypes;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.ArgumentTypes;
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.ArgumentTypes;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
+10
-10
@@ -1,13 +1,13 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.team.config.gui.GlobalSettingsGui;
|
||||
import fr.luc.crcore.team.config.gui.TeamSettingsGui;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.features.team.config.gui.GlobalSettingsGui;
|
||||
import fr.luc.crcore.features.team.config.gui.TeamSettingsGui;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
@@ -31,7 +31,7 @@ public class TeamSettingsSubCommand extends SubCommand {
|
||||
|
||||
public TeamSettingsSubCommand(TeamConfigService config,
|
||||
MessagesService messages,
|
||||
fr.luc.crcore.team.TeamService teamService) {
|
||||
fr.luc.crcore.features.team.TeamService teamService) {
|
||||
super("settings");
|
||||
this.config = Objects.requireNonNull(config, "config");
|
||||
this.messages = Objects.requireNonNull(messages, "messages");
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.ArgumentTypes;
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.TeamRanking;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.ArgumentTypes;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.TeamRanking;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.ArgumentTypes;
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.util.command.ArgumentTypes;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
+9
-9
@@ -1,13 +1,13 @@
|
||||
package fr.luc.crcore.command.builtin.team;
|
||||
package fr.luc.crcore.features.team.command;
|
||||
|
||||
import fr.luc.crcore.command.ArgumentTypes;
|
||||
import fr.luc.crcore.command.CommandContext;
|
||||
import fr.luc.crcore.command.CommandResult;
|
||||
import fr.luc.crcore.command.SubCommand;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.team.TeamVisibility;
|
||||
import fr.luc.crcore.util.command.ArgumentTypes;
|
||||
import fr.luc.crcore.util.command.CommandContext;
|
||||
import fr.luc.crcore.util.command.CommandResult;
|
||||
import fr.luc.crcore.util.command.SubCommand;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import fr.luc.crcore.features.team.TeamVisibility;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.team.config;
|
||||
package fr.luc.crcore.features.team.config;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.team.config;
|
||||
package fr.luc.crcore.features.team.config;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.team.config;
|
||||
package fr.luc.crcore.features.team.config;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
+6
-6
@@ -1,9 +1,9 @@
|
||||
package fr.luc.crcore.team.config.gui;
|
||||
package fr.luc.crcore.features.team.config.gui;
|
||||
|
||||
import fr.luc.crcore.gui.AbstractInventoryGui;
|
||||
import fr.luc.crcore.gui.GuiItems;
|
||||
import fr.luc.crcore.team.config.TeamSetting;
|
||||
import fr.luc.crcore.team.config.TeamSettings;
|
||||
import fr.luc.crcore.util.gui.AbstractInventoryGui;
|
||||
import fr.luc.crcore.util.gui.GuiItems;
|
||||
import fr.luc.crcore.features.team.config.TeamSetting;
|
||||
import fr.luc.crcore.features.team.config.TeamSettings;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
@@ -120,7 +120,7 @@ public abstract class AbstractSettingsGui extends AbstractInventoryGui {
|
||||
}
|
||||
}
|
||||
|
||||
private <T> fr.luc.crcore.gui.GuiClickHandler createIntHandler(TeamSetting<T> setting, Integer baseValue) {
|
||||
private <T> fr.luc.crcore.util.gui.GuiClickHandler createIntHandler(TeamSetting<T> setting, Integer baseValue) {
|
||||
return event -> {
|
||||
Integer current = (Integer) getCurrentValue((TeamSetting<?>) setting);
|
||||
int amount = computeIntDelta(event);
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package fr.luc.crcore.team.config.gui;
|
||||
package fr.luc.crcore.features.team.config.gui;
|
||||
|
||||
import fr.luc.crcore.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.team.config.TeamSetting;
|
||||
import fr.luc.crcore.features.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.features.team.config.TeamSetting;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
package fr.luc.crcore.team.config.gui;
|
||||
package fr.luc.crcore.features.team.config.gui;
|
||||
|
||||
import fr.luc.crcore.gui.GuiItems;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.team.config.TeamSetting;
|
||||
import fr.luc.crcore.team.config.TeamSettings;
|
||||
import fr.luc.crcore.util.gui.GuiItems;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.features.team.config.TeamSetting;
|
||||
import fr.luc.crcore.features.team.config.TeamSettings;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.Objects;
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
package fr.luc.crcore.team.config.impl;
|
||||
package fr.luc.crcore.features.team.config.impl;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamRepository;
|
||||
import fr.luc.crcore.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.team.config.TeamSetting;
|
||||
import fr.luc.crcore.team.config.TeamSettings;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamRepository;
|
||||
import fr.luc.crcore.features.team.config.TeamConfigService;
|
||||
import fr.luc.crcore.features.team.config.TeamSetting;
|
||||
import fr.luc.crcore.features.team.config.TeamSettings;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package fr.luc.crcore.team.event;
|
||||
package fr.luc.crcore.features.team.event;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamMember;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamMember;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.Objects;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.team.event;
|
||||
package fr.luc.crcore.features.team.event;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.team.event;
|
||||
package fr.luc.crcore.features.team.event;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/** Déclenché juste après la dissolution d'une équipe. */
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.team.event;
|
||||
package fr.luc.crcore.features.team.event;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
import java.util.Objects;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.team.event;
|
||||
package fr.luc.crcore.features.team.event;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.Objects;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package fr.luc.crcore.team.event;
|
||||
package fr.luc.crcore.features.team.event;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamMember;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamMember;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.Objects;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.team.event;
|
||||
package fr.luc.crcore.features.team.event;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.Objects;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.team.event;
|
||||
package fr.luc.crcore.features.team.event;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.Objects;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.team.event;
|
||||
package fr.luc.crcore.features.team.event;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package fr.luc.crcore.team.event;
|
||||
package fr.luc.crcore.features.team.event;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamVisibility;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamVisibility;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.Objects;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.team.exception;
|
||||
package fr.luc.crcore.features.team.exception;
|
||||
|
||||
public class TeamAccessException extends TeamException {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.team.exception;
|
||||
package fr.luc.crcore.features.team.exception;
|
||||
|
||||
public class TeamAlreadyExistsException extends TeamException {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.team.exception;
|
||||
package fr.luc.crcore.features.team.exception;
|
||||
|
||||
public class TeamException extends RuntimeException {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.team.exception;
|
||||
package fr.luc.crcore.features.team.exception;
|
||||
|
||||
public class TeamNotFoundException extends TeamException {
|
||||
|
||||
+22
-22
@@ -1,26 +1,26 @@
|
||||
package fr.luc.crcore.team.impl;
|
||||
import fr.luc.crcore.team.exception.TeamAccessException;
|
||||
import fr.luc.crcore.team.exception.TeamNotFoundException;
|
||||
import fr.luc.crcore.team.exception.TeamAlreadyExistsException;
|
||||
import fr.luc.crcore.team.exception.TeamException;
|
||||
import fr.luc.crcore.team.TeamRepository;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.team.TeamRanking;
|
||||
import fr.luc.crcore.team.TeamVisibility;
|
||||
import fr.luc.crcore.team.TeamColor;
|
||||
import fr.luc.crcore.team.TeamRole;
|
||||
import fr.luc.crcore.team.TeamMember;
|
||||
import fr.luc.crcore.team.Team;
|
||||
package fr.luc.crcore.features.team.impl;
|
||||
import fr.luc.crcore.features.team.exception.TeamAccessException;
|
||||
import fr.luc.crcore.features.team.exception.TeamNotFoundException;
|
||||
import fr.luc.crcore.features.team.exception.TeamAlreadyExistsException;
|
||||
import fr.luc.crcore.features.team.exception.TeamException;
|
||||
import fr.luc.crcore.features.team.TeamRepository;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import fr.luc.crcore.features.team.TeamRanking;
|
||||
import fr.luc.crcore.features.team.TeamVisibility;
|
||||
import fr.luc.crcore.features.team.TeamColor;
|
||||
import fr.luc.crcore.features.team.TeamRole;
|
||||
import fr.luc.crcore.features.team.TeamMember;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
|
||||
import fr.luc.crcore.team.event.PlayerJoinTeamEvent;
|
||||
import fr.luc.crcore.team.event.TeamCreateEvent;
|
||||
import fr.luc.crcore.team.event.TeamDissolveEvent;
|
||||
import fr.luc.crcore.team.event.TeamLeadershipTransferEvent;
|
||||
import fr.luc.crcore.team.event.TeamMemberAddEvent;
|
||||
import fr.luc.crcore.team.event.TeamMemberRemoveEvent;
|
||||
import fr.luc.crcore.team.event.TeamScoreChangeEvent;
|
||||
import fr.luc.crcore.team.event.TeamSpawnPointChangeEvent;
|
||||
import fr.luc.crcore.team.event.TeamVisibilityChangeEvent;
|
||||
import fr.luc.crcore.features.team.event.PlayerJoinTeamEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamCreateEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamDissolveEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamLeadershipTransferEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamMemberAddEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamMemberRemoveEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamScoreChangeEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamSpawnPointChangeEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamVisibilityChangeEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
+13
-13
@@ -1,16 +1,16 @@
|
||||
package fr.luc.crcore.team.impl;
|
||||
import fr.luc.crcore.team.exception.TeamAccessException;
|
||||
import fr.luc.crcore.team.exception.TeamNotFoundException;
|
||||
import fr.luc.crcore.team.exception.TeamAlreadyExistsException;
|
||||
import fr.luc.crcore.team.exception.TeamException;
|
||||
import fr.luc.crcore.team.TeamRepository;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.team.TeamRanking;
|
||||
import fr.luc.crcore.team.TeamVisibility;
|
||||
import fr.luc.crcore.team.TeamColor;
|
||||
import fr.luc.crcore.team.TeamRole;
|
||||
import fr.luc.crcore.team.TeamMember;
|
||||
import fr.luc.crcore.team.Team;
|
||||
package fr.luc.crcore.features.team.impl;
|
||||
import fr.luc.crcore.features.team.exception.TeamAccessException;
|
||||
import fr.luc.crcore.features.team.exception.TeamNotFoundException;
|
||||
import fr.luc.crcore.features.team.exception.TeamAlreadyExistsException;
|
||||
import fr.luc.crcore.features.team.exception.TeamException;
|
||||
import fr.luc.crcore.features.team.TeamRepository;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import fr.luc.crcore.features.team.TeamRanking;
|
||||
import fr.luc.crcore.features.team.TeamVisibility;
|
||||
import fr.luc.crcore.features.team.TeamColor;
|
||||
import fr.luc.crcore.features.team.TeamRole;
|
||||
import fr.luc.crcore.features.team.TeamMember;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
+15
-15
@@ -1,19 +1,19 @@
|
||||
package fr.luc.crcore.team.impl;
|
||||
import fr.luc.crcore.team.exception.TeamAccessException;
|
||||
import fr.luc.crcore.team.exception.TeamNotFoundException;
|
||||
import fr.luc.crcore.team.exception.TeamAlreadyExistsException;
|
||||
import fr.luc.crcore.team.exception.TeamException;
|
||||
import fr.luc.crcore.team.TeamRepository;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.team.TeamRanking;
|
||||
import fr.luc.crcore.team.TeamVisibility;
|
||||
import fr.luc.crcore.team.TeamColor;
|
||||
import fr.luc.crcore.team.TeamRole;
|
||||
import fr.luc.crcore.team.TeamMember;
|
||||
import fr.luc.crcore.team.Team;
|
||||
package fr.luc.crcore.features.team.impl;
|
||||
import fr.luc.crcore.features.team.exception.TeamAccessException;
|
||||
import fr.luc.crcore.features.team.exception.TeamNotFoundException;
|
||||
import fr.luc.crcore.features.team.exception.TeamAlreadyExistsException;
|
||||
import fr.luc.crcore.features.team.exception.TeamException;
|
||||
import fr.luc.crcore.features.team.TeamRepository;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import fr.luc.crcore.features.team.TeamRanking;
|
||||
import fr.luc.crcore.features.team.TeamVisibility;
|
||||
import fr.luc.crcore.features.team.TeamColor;
|
||||
import fr.luc.crcore.features.team.TeamRole;
|
||||
import fr.luc.crcore.features.team.TeamMember;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
|
||||
import fr.luc.crcore.database.ColumnType;
|
||||
import fr.luc.crcore.database.Database;
|
||||
import fr.luc.crcore.util.database.ColumnType;
|
||||
import fr.luc.crcore.util.database.Database;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
+13
-13
@@ -1,16 +1,16 @@
|
||||
package fr.luc.crcore.team.impl;
|
||||
import fr.luc.crcore.team.exception.TeamAccessException;
|
||||
import fr.luc.crcore.team.exception.TeamNotFoundException;
|
||||
import fr.luc.crcore.team.exception.TeamAlreadyExistsException;
|
||||
import fr.luc.crcore.team.exception.TeamException;
|
||||
import fr.luc.crcore.team.TeamRepository;
|
||||
import fr.luc.crcore.team.TeamService;
|
||||
import fr.luc.crcore.team.TeamRanking;
|
||||
import fr.luc.crcore.team.TeamVisibility;
|
||||
import fr.luc.crcore.team.TeamColor;
|
||||
import fr.luc.crcore.team.TeamRole;
|
||||
import fr.luc.crcore.team.TeamMember;
|
||||
import fr.luc.crcore.team.Team;
|
||||
package fr.luc.crcore.features.team.impl;
|
||||
import fr.luc.crcore.features.team.exception.TeamAccessException;
|
||||
import fr.luc.crcore.features.team.exception.TeamNotFoundException;
|
||||
import fr.luc.crcore.features.team.exception.TeamAlreadyExistsException;
|
||||
import fr.luc.crcore.features.team.exception.TeamException;
|
||||
import fr.luc.crcore.features.team.TeamRepository;
|
||||
import fr.luc.crcore.features.team.TeamService;
|
||||
import fr.luc.crcore.features.team.TeamRanking;
|
||||
import fr.luc.crcore.features.team.TeamVisibility;
|
||||
import fr.luc.crcore.features.team.TeamColor;
|
||||
import fr.luc.crcore.features.team.TeamRole;
|
||||
import fr.luc.crcore.features.team.TeamMember;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
package fr.luc.crcore.player;
|
||||
|
||||
import fr.luc.crcore.common.Repository;
|
||||
|
||||
public interface PlayerProfileRepository extends Repository<PlayerProfile> {
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.broadcast;
|
||||
package fr.luc.crcore.util.broadcast;
|
||||
|
||||
/**
|
||||
* Public destinataire d'un broadcast CR-Core.
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fr.luc.crcore.broadcast;
|
||||
package fr.luc.crcore.util.broadcast;
|
||||
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.broadcast;
|
||||
package fr.luc.crcore.util.broadcast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+14
-14
@@ -1,18 +1,18 @@
|
||||
package fr.luc.crcore.broadcast;
|
||||
package fr.luc.crcore.util.broadcast;
|
||||
|
||||
import fr.luc.crcore.player.event.PlayerProfileCreateEvent;
|
||||
import fr.luc.crcore.player.event.PlayerProfileDeleteEvent;
|
||||
import fr.luc.crcore.player.event.PlayerScoreChangeEvent;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.event.PlayerJoinTeamEvent;
|
||||
import fr.luc.crcore.team.event.TeamCreateEvent;
|
||||
import fr.luc.crcore.team.event.TeamDissolveEvent;
|
||||
import fr.luc.crcore.team.event.TeamLeadershipTransferEvent;
|
||||
import fr.luc.crcore.team.event.TeamMemberAddEvent;
|
||||
import fr.luc.crcore.team.event.TeamMemberRemoveEvent;
|
||||
import fr.luc.crcore.team.event.TeamScoreChangeEvent;
|
||||
import fr.luc.crcore.team.event.TeamSpawnPointChangeEvent;
|
||||
import fr.luc.crcore.team.event.TeamVisibilityChangeEvent;
|
||||
import fr.luc.crcore.features.player.event.PlayerProfileCreateEvent;
|
||||
import fr.luc.crcore.features.player.event.PlayerProfileDeleteEvent;
|
||||
import fr.luc.crcore.features.player.event.PlayerScoreChangeEvent;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.event.PlayerJoinTeamEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamCreateEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamDissolveEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamLeadershipTransferEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamMemberAddEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamMemberRemoveEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamScoreChangeEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamSpawnPointChangeEvent;
|
||||
import fr.luc.crcore.features.team.event.TeamVisibilityChangeEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.event.EventHandler;
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
package fr.luc.crcore.broadcast.impl;
|
||||
package fr.luc.crcore.util.broadcast.impl;
|
||||
|
||||
import fr.luc.crcore.broadcast.BroadcastAudience;
|
||||
import fr.luc.crcore.broadcast.BroadcastContext;
|
||||
import fr.luc.crcore.broadcast.BroadcastService;
|
||||
import fr.luc.crcore.message.MessagesService;
|
||||
import fr.luc.crcore.team.Team;
|
||||
import fr.luc.crcore.team.TeamMember;
|
||||
import fr.luc.crcore.util.broadcast.BroadcastAudience;
|
||||
import fr.luc.crcore.util.broadcast.BroadcastContext;
|
||||
import fr.luc.crcore.util.broadcast.BroadcastService;
|
||||
import fr.luc.crcore.util.message.MessagesService;
|
||||
import fr.luc.crcore.features.team.Team;
|
||||
import fr.luc.crcore.features.team.TeamMember;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.command;
|
||||
package fr.luc.crcore.util.command;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.command;
|
||||
package fr.luc.crcore.util.command;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.command;
|
||||
package fr.luc.crcore.util.command;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.command;
|
||||
package fr.luc.crcore.util.command;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.command;
|
||||
package fr.luc.crcore.util.command;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.command;
|
||||
package fr.luc.crcore.util.command;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.command;
|
||||
package fr.luc.crcore.util.command;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.command;
|
||||
package fr.luc.crcore.util.command;
|
||||
|
||||
public class CommandException extends RuntimeException {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.command;
|
||||
package fr.luc.crcore.util.command;
|
||||
|
||||
public final class CommandResult {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.command;
|
||||
package fr.luc.crcore.util.command;
|
||||
|
||||
/**
|
||||
* Sous-commande imbriquée. Peut être :
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.common;
|
||||
package fr.luc.crcore.util.common;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.common;
|
||||
package fr.luc.crcore.util.common;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.common;
|
||||
package fr.luc.crcore.util.common;
|
||||
|
||||
public interface Named {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.luc.crcore.common;
|
||||
package fr.luc.crcore.util.common;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user