DearU

A paper plugin for mailbox

15

DearU

<div align="center">

📬 DearU

A modern mailbox plugin for Paper/Folia servers

</div>

✨ Features

- 📮 Command Aliases - Players can receive and manage their mail through a beautiful GUI - 📦 Command Aliases - Send single items or multi-item packages to players - 💾 Command Aliases - Built-in support for SQLite and MySQL - ⚡ Command Aliases - Non-blocking mail operations using `CompletableFuture` - 🎨 Command Aliases - Clean Java interface for plugin developers - 🛠️ Command Aliases - Customizable command aliases

📁 Project Structure

``` DearU/ ├── api/ # Java module with public interfaces │ └── DearU # Main plugin interface │ ├── Mailbox # Async mailbox operations │ ├── Mail # Sealed interface for mail types │ │ ├── SingleMail # Single item mail │ │ └── PackageMail # Multi-item package │ ├── MailSender # Mail sender representation │ └── MailboxManager # Mailbox instance manager │ └── core/ # Kotlin module with implementations └── DearUPlugin # Main plugin class ├── DearUConfiguration # Config system ├── DatabaseManager # Database abstraction ├── MailboxManagerImpl # Mailbox implementation └── MailboxGui # GUI implementation ```

🚀 Getting Started

Requirements

- Paper/Folia or higher - Paper/Folia server (latest version)

Installation

1. Build the plugin: ```bash ./gradlew build ```

2. Find the JAR in `core/build/libs/`

3. Place it in your server's `plugins/` folder

4. Restart your server

Configuration

Edit `plugins/DearU/config.yml` to customize:

```yaml

Database settings (SQLite/MySQL)

database: sql: type: SQLITE # or MYSQL mysql: host: localhost port: 3306 database: dearu username: root password: password

Command aliases

commands: mailbox: aliases: - mail - 우편함 ```

💻 Development

Build Commands

```bash

Build the project

./gradlew build

Run test server (Paper)

./gradlew runServer

Run Folia test server

./gradlew runFolia

Clean build artifacts

./gradlew clean ```

API Usage

Sending Mail

```java import com.bindglam.dearu.DearU; import com.bindglam.dearu.mail.*;

// Get plugin instance DearU dearU = DearUProvider.get();

// Send single item mail Mail singleMail = Mail.single( MailSender.server(), itemStack, "Welcome to our server!" ); dearu.mailboxManager().getMailbox(playerUUID) .putMail(singleMail);

// Send package mail PackageMail.Body body = PackageMail.bodyBuilder() .name("Welcome Package") .content(itemStack1) .content(itemStack2) .build();

Mail packageMail = Mail.packaged( MailSender.player(senderUUID), body, "Here's your starter kit!" ); dearu.mailboxManager().getMailbox(playerUUID) .putMail(packageMail); ```

Reading Mail

```java import com.bindglam.dearu.Mailbox; import java.util.concurrent.CompletableFuture;

Mailbox mailbox = dearU.mailboxManager().getMailbox(playerUUID);

// Get all mail (async) CompletableFuture<List<Mailbox.IdentifiedMail>> future = mailbox.mails(); future.thenAccept(mails -> { for (Mailbox.IdentifiedMail identified : mails) { Mail mail = identified.mail(); // Process mail... } });

// Get specific mail by ID CompletableFuture<Mailbox.IdentifiedMail> mailFuture = mailbox.mail(mailId); mailFuture.thenAccept(identified -> { if (identified != null) { Mail mail = identified.mail(); // Process mail... } }); ```

🏗️ Architecture

Managerial Pattern

All managers implement the `Managerial` interface:

```kotlin interface Managerial { fun start(context: Context) fun end(context: Context) } ```

Managers are initialized in plugin lifecycle: ```kotlin val managers = listOf(DatabaseManager, MailboxManagerImpl) managers.forEach { it.start(Context(this, dearUConfig)) } ```

Database Abstraction

Uses `DatabaseLib` for unified SQL operations:

- MySQL - Default, uses `database.db` in plugin data folder - MySQL - Configurable for production use

Configuration System

Nested class-based configuration using `ConfigLib`: ```kotlin class Commands { val mailbox = createExtendedComplexField { CommandField("mailbox") } } ```

🔧 Dependencies

Runtime Dependencies

- semver4j (1.0.0) - Configuration system - semver4j (1.0.4) - Database abstraction - semver4j (6.0.0) - Version comparison

Build Dependencies

- RunPaper - JAR shading and relocation - RunPaper - Test server management

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📞 Support

- 🐛 Report bugs via GitHub Issues - 💡 Feature requests welcome - 📖 Check the code documentation for more details

---

<div align="center">

Made with ❤️ for the Minecraft community

</div>

ADS