A production-ready Minecraft plugin template showcasing IonAPI v1.2.0 features and best practices.
- ORM System - Entity mapping with
@Table,@PrimaryKey,@Columnannotations - Caching - Automatic entity caching with
@Cacheablefor 10-50x performance boost - Async Operations - Non-blocking database queries with CompletableFuture
- SQLite & MySQL - Switchable database backends via configuration
- Full Economy Provider - Complete implementation with transactions
- Vault Integration - Compatible with Vault-dependent plugins
- Transaction API - Fluent builder pattern for complex operations
- Async by Default - All economy operations are non-blocking
- Main Menu GUI - Central hub for accessing all features
- GUI Framework - Inventory-based menus with click handlers
- Interactive Commands - All commands open beautiful GUIs
- Shop System - Item purchasing with economy integration
- Live Scoreboard - Auto-updating sidebar with placeholders (no flashing!)
- MiniMessage - Modern text formatting with colors and styles
- Cooldown Manager - Thread-safe player cooldown tracking
- Rate Limiter - Spam prevention with sliding window algorithm
- Hot-Reload Config - Live configuration updates without restart
- Metrics Tracking - Built-in performance monitoring
- Redis Pub/Sub - Cross-server messaging (optional)
- Task Scheduler - Unified async/sync task API
- Warp System - Save and teleport to custom locations
- Leaderboards - Top players by kills, deaths, and K/D ratio
- BossBar Manager - Progress bars, health bars, and notifications
- Messages System - Externalized messages with MiniMessage support
| Command | Description | Permission |
|---|---|---|
/menu |
Open main menu GUI (hub for all features) | iontemplate.menu |
/spawn |
Teleport to spawn (30s cooldown) | iontemplate.spawn |
/balance |
Open balance GUI | iontemplate.balance |
/pay <player> <amount> |
Transfer money (5s cooldown) | iontemplate.pay |
/shop |
Open shop GUI | iontemplate.shop |
/stats |
Open stats GUI | iontemplate.stats |
/scoreboard |
Toggle scoreboard display | iontemplate.scoreboard |
/warp [list|set|delete] [name] |
Open warp GUI or manage warps | iontemplate.warp |
/leaderboard |
Open leaderboard GUI | iontemplate.leaderboard |
Aliases:
/menuβ/gui,/mainmenu/balanceβ/bal,/money/leaderboardβ/lb,/top
- Java 21 or higher
- Gradle 8.0+ (wrapper included)
- IonAPI 1.2.0 (see build steps)
- Clone both repositories
# Clone IonAPI
git clone https://github.com/mattbaconz/IonAPI.git
cd IonAPI
./gradlew publishToMavenLocal
cd ..
# Clone template
git clone https://github.com/mattbaconz/ion-plugin-template.git
cd ion-plugin-template- Build the plugin
./gradlew shadowJarOutput: build/libs/IonTemplatePlugin-1.0.0.jar (419KB)
The repository includes a GitHub Actions workflow that automatically:
- Checks out IonAPI from the main repository
- Builds and publishes IonAPI to local Maven
- Builds the template plugin
- Uploads the JAR as an artifact
Simply push to main or develop branch to trigger the build.
Note: IonAPI must be available in the main repository for CI/CD builds to work.
Test the plugin with MySQL and Redis instantly:
# Start services
docker-compose up -d
# Build and deploy
./gradlew shadowJar
docker-compose restart paper
# View logs
docker-compose logs -f paperSee DOCKER.md for detailed Docker setup.
Edit plugins/IonTemplatePlugin/config.yml:
# Database settings
database:
type: sqlite # sqlite or mysql
mysql:
host: localhost
port: 3306
database: minecraft
username: root
password: ""
# Economy settings
economy:
starting-balance: 1000.0
currency-symbol: "$"
# Cooldowns (seconds)
cooldowns:
teleport: 30
pay: 5
# Rate limits
rate-limits:
chat:
max-messages: 5
window-seconds: 10
# Redis (optional)
redis:
enabled: false
host: localhost
port: 6379Changes apply instantly via hot-reload!
src/main/java/com/example/iontemplate/
βββ IonTemplatePlugin.java # Main plugin class
βββ command/ # Command handlers (9 commands)
β βββ MenuCommand.java # NEW: Main menu
β βββ BalanceCommand.java # Opens balance GUI
β βββ PayCommand.java
β βββ ShopCommand.java
β βββ SpawnCommand.java
β βββ StatsCommand.java # Opens stats GUI
β βββ ScoreboardCommand.java
β βββ WarpCommand.java # Opens warp GUI
β βββ LeaderboardCommand.java # Opens leaderboard GUI
βββ data/ # Database entities
β βββ PlayerData.java # Player stats (@Cacheable)
β βββ PlayerBalance.java # Economy balances
β βββ Warp.java # Saved locations
βββ economy/ # Economy implementation
β βββ TemplateEconomyProvider.java
βββ gui/ # GUI menus (NEW: 6 GUIs!)
β βββ MainMenuGui.java # Central hub
β βββ BalanceGui.java # Balance viewer
β βββ StatsGui.java # Stats viewer
β βββ LeaderboardGui.java # Top players
β βββ WarpGui.java # Warp teleporter
β βββ ShopGui.java # Shop system
βββ listener/ # Event listeners
β βββ PlayerListener.java
βββ manager/ # Feature managers
βββ ScoreboardManager.java # Fixed flashing issue
βββ BossBarManager.java # BossBar API
@Table("player_data")
@Cacheable(ttl = 60, maxSize = 500) // Cache for 60 seconds
public class PlayerData {
@PrimaryKey
private UUID uuid;
@Column(name = "player_name", nullable = false)
private String name;
@Column(defaultValue = "0")
private int kills;
// Getters/setters...
}database.findAsync(PlayerData.class, uuid).thenAccept(opt -> {
if (opt.isPresent()) {
PlayerData data = opt.get();
data.addKill();
database.saveAsync(data);
}
});IonEconomy.transaction(player.getUniqueId())
.withdraw(BigDecimal.valueOf(100))
.reason("Shop purchase")
.commit()
.thenAccept(result -> {
if (result.isSuccess()) {
player.sendMessage("Purchase complete!");
}
});// Open the main menu - access all features from one place!
new MainMenuGui(plugin).open(player);
// Players can access:
// - Stats GUI (kills, deaths, K/D, playtime)
// - Balance GUI (view balance, top balances)
// - Shop GUI (purchase items)
// - Warp GUI (teleport to saved locations)
// - Leaderboard GUI (top kills, deaths, K/D)
// - Toggle scoreboardnew IonGuiBuilder()
.title("<gold><bold>Shop Menu")
.rows(3)
.item(10, diamondSword, click -> {
purchaseItem(click.getPlayer(), "diamond_sword");
})
.build()
.open(player);- Database: 10-50x faster with automatic caching
- JAR Size: 419KB (includes all dependencies + 6 GUI menus)
- Memory: ~5MB runtime footprint
- Startup: <100ms initialization
- Scoreboard: No flashing, smooth updates every second
Comment out unused modules in build.gradle.kts:
dependencies {
// Remove Redis if not needed (-15KB + Jedis)
// implementation("com.ionapi:ion-redis:1.2.0")
// Remove database if not needed (-53KB + HikariCP)
// implementation("com.ionapi:ion-database:1.2.0")
}Uncomment in build.gradle.kts to avoid conflicts:
tasks.shadowJar {
relocate("com.ionapi", "${project.group}.libs.ionapi")
}The IDE may not see IonAPI dependencies. This is normal - the code compiles fine with Gradle.
Fix: Reload Gradle project or run:
./gradlew --refresh-dependencies buildSQLite: Ensure plugins/IonTemplatePlugin/ folder exists
MySQL: Verify credentials and database exists
Redis is optional. Set redis.enabled: false in config if not using.
- IonAPI Repository: github.com/mattbaconz/IonAPI
- IonAPI Documentation: View Docs
- Template Repository: github.com/mattbaconz/ion-plugin-template
- Discord Support: discord.com/invite/VQjTVKjs46
- Report Issues: GitHub Issues
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This template is licensed under the MIT License - see LICENSE for details.
If you find this template helpful:
- β Star the repository on GitHub
- π Report bugs via GitHub Issues
- π¬ Join our community on Discord
- β Support development:
mattbaconz
- GitHub: @mattbaconz
- Discord: Join Server
Built with β€οΈ using IonAPI