Reorganize package structure

Henri Schubin 2024-07-27 13:58:43 +03:00
parent a29f39d4c6
commit b49e9ee1bd

32
Home.md

@ -13,26 +13,36 @@ Platform modules (eg. `:bukkit`, `:bungee` etc.)
+ Platform specific code + Platform specific code
- `:<platform>:loader` (rarely need to be touched) - `:<platform>:loader` (rarely need to be touched)
+ For jarinjar loading, explained later in this guide + For jarinjar loading, explained later in this guide
- `:bukkit:bukkit1_12`, `:bukkit:folia`, `:bukkit:paper`, `:bukkit:spigot`
+ Implementations for specific server distributions
Misc. modules (rarely need to be touched) Misc. modules (rarely need to be touched)
- `:common:common-api` - `:common:common-api`
+ This contains the Slf4j implementation which needs to be included in loaders but doesn't need to be accessed by API users + This contains the Slf4j implementation which needs to be included in loaders but doesn't need to be accessed by API users
- `:common:common-unrelocate`
+ `compileOnly` classes (not included in the jar) that are relocated to their original package, allowing DiscordSRV code to use unrelocated versions of classes while also relocating that class (for example `org.slf4j.Logger` is relocated in DiscordSRV, but Velocity's logger is also that same class unrelocated, so the "unrelocate" class can be used to use original)
- `:i18n` - `:i18n`
+ Standalone java app to generate a file for Crowdin from the platform's Configuration's + Standalone java app to generate a file for Crowdin from the platform's Configuration's
Packages Packages
- Classes and interfaces are organized into packages based on what they do or what they are related to - Sorted based on their 'concept' with a few exceptions
- Examples: - Examples:
+ Group sync goes in `groupsync` + Everything related to bans go in `ban/`
+ Message forwarding from Minecraft -> Discord goes in `messageforwarding.minecrafttodiscord` + Everything related to Discord and game commands go in `command/game/` and `command/discord/`
+ SQL goes in `storage` - Exceptions:
+ Channel locking goes in `channel` + Configurations in `config/`
+ etc. + Events in `events/`
- Some 'exceptions': + Exceptions in `exception/`
+ Configs are kept under `config.<config name>` (in each module) + Util classes in `util/`
+ Events are under `event.events` (in `:api`) + Helper classes in `helper/`
+ Module types are under `module.type` (in `:api` and `:common`) - Common module top-level packages:
+ Integrations are grouped together into `integration` (in each module) - Due to the amount of packages in common they are split into some top level packages to keep things organized
- `abstraction/` Abstractions
- `command/discord/`, `command/game/`, `command/combined/` Discord, game and combined (Discord+game) commands
- `config/` Configs and Configurate classes
- `core/` Core DiscordSRV functionality (components, event bus, dependency loading, module system, logging, placeholder service, storage)
- `feature/` DiscordSRV feature implementations
- `helper/` Classes to reduce amount of duplicate code, and to keep long common code paths in separate classes
## Buildscript (Gradle) ## Buildscript (Gradle)