/
CompletableFutureDearU/
├── 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
Build the plugin:
./gradlew build
Find the JAR in core/build/libs/
Place it in your server's plugins/ folder
Restart your server
Edit plugins/DearU/config.yml to customize:
# 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
- 우편함
# Build the project
./gradlew build
# Run test server (Paper)
./gradlew runServer
# Run Folia test server
./gradlew runFolia
# Clean build artifacts
./gradlew clean
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);
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...
}
});
All managers implement the Managerial interface:
interface Managerial {
fun start(context: Context)
fun end(context: Context)
}
Managers are initialized in plugin lifecycle:
val managers = listOf(DatabaseManager, MailboxManagerImpl)
managers.forEach { it.start(Context(this, dearUConfig)) }
Uses DatabaseLib for unified SQL operations:
database.db in plugin data folderNested class-based configuration using ConfigLib:
class Commands {
val mailbox = createExtendedComplexField { CommandField("mailbox") }
}
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Made with ❤️ for the Minecraft community