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>:loader` (rarely need to be touched)
+ 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)
- `: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
- `: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`
+ Standalone java app to generate a file for Crowdin from the platform's Configuration's
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:
+ Group sync goes in `groupsync`
+ Message forwarding from Minecraft -> Discord goes in `messageforwarding.minecrafttodiscord`
+ SQL goes in `storage`
+ Channel locking goes in `channel`
+ etc.
- Some 'exceptions':
+ Configs are kept under `config.<config name>` (in each module)
+ Events are under `event.events` (in `:api`)
+ Module types are under `module.type` (in `:api` and `:common`)
+ Integrations are grouped together into `integration` (in each module)
+ Everything related to bans go in `ban/`
+ Everything related to Discord and game commands go in `command/game/` and `command/discord/`
- Exceptions:
+ Configurations in `config/`
+ Events in `events/`
+ Exceptions in `exception/`
+ Util classes in `util/`
+ Helper classes in `helper/`
- Common module top-level packages:
- 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)