promotional bannermobile promotional banner
premium banner
HyDB provides a professional SQLite database API for Hytale plugins. Features async operations, per-world & global databases, schema migrations, transactions, and admin debug commands. Simple API - install once, all plugins benefit.

Description

HyDB - Professional SQLite Database API for Hytale

๐Ÿ“Š Overview

HyDB is a professional base plugin for Hytale that provides a comprehensive SQLite database API for persistent data storage. It allows other plugins to easily store and retrieve data without managing database connections themselves.

Think of it as a database service layer - install HyDB once, and all your other plugins can use it for reliable, fast, thread-safe data storage.


โœจ Key Features

๐Ÿ—„๏ธ Database Management

  • SQLite with JDBC - Industry-standard embedded database (no external server needed)
  • Per-World & Global Databases - Store data globally across all worlds or per-world
  • Automatic Connection Management - HyDB handles all database lifecycle
  • File-Based Storage - Each plugin gets its own database file for complete isolation

โšก Performance & Safety

  • Async Operations - Non-blocking database calls using Java 25 virtual threads
  • Thread-Safe - Safe concurrent access from multiple plugins/threads
  • Connection Pooling - Efficient resource management
  • WAL Mode - Write-Ahead Logging for better performance

๐Ÿ”ง Complete API

  • Full CRUD Operations - Create, Read, Update, Delete with simple API
  • Schema Migrations - Version and upgrade database schemas automatically
  • Transaction Support - Execute multiple operations atomically
  • Blob Storage - Store binary data (images, files, serialized objects)
  • Query Builder - Fluent API for constructing complex SQL queries
  • Prepared Statements - Built-in SQL injection protection

๐ŸŽฎ In-Game Admin Commands

  • /hydb list - View all databases with file sizes
  • /hydb info <db> - Show database details and statistics
  • /hydb tables <db> - List all tables with row counts
  • /hydb query <db> "SQL" - Execute SELECT queries for debugging
  • Read-only queries ensure data safety

๐Ÿ“ฆ Installation

  1. Download HyDB-1.0.0.jar
  2. Place in your server's mods folder
  3. Restart your server
  4. Done! Other plugins can now use HyDB

Requirements:

  • Hytale Server (latest version)
  • Java 25+

๐Ÿ‘จโ€๐Ÿ’ป For Plugin Developers

Quick Start

// Get the API
HyDBAPI api = HyDBPlugin.getAPI();

// Get or create a database
Database db = api.getGlobalDatabase("myplugin");

// Create a table
db.createTable("users",
    "id INTEGER PRIMARY KEY AUTOINCREMENT",
    "uuid TEXT NOT NULL UNIQUE",
    "username TEXT NOT NULL",
    "coins INTEGER DEFAULT 0"
);

// Insert data (async)
Map<String, Object> data = new HashMap<>();
data.put("uuid", player.getUniqueId().toString());
data.put("username", player.getName());
data.put("coins", 100);

db.insertAsync("users", data).thenAccept(rows -> {
    System.out.println("Player data saved!");
});

// Query data (async)
db.queryFirstAsync("SELECT * FROM users WHERE uuid = ?", playerUUID.toString())
    .thenAccept(user -> {
        if (user != null) {
            int coins = (int) user.get("coins");
            // Use the data
        }
    });

Database Scope

// Global database - shared across all worlds (economy, player stats)
Database global = api.getGlobalDatabase("economy");

// Per-world database - isolated per world (claims, regions)
Database world = api.getWorldDatabase(world, "claims");

๐ŸŽฏ Use Cases

Perfect for plugins that need:

  • โœ… Economy Systems - Player balances, shops, transactions
  • โœ… Player Statistics - Stats tracking, leaderboards, achievements
  • โœ… Land Claims - Territory ownership, permissions
  • โœ… Custom Game Modes - Game state, progression tracking
  • โœ… Social Features - Friends lists, guilds, parties
  • โœ… Admin Tools - Bans, warnings, action logs
  • โœ… RPG Systems - Character data, skills, inventory
  • โœ… Any Persistent Data - Anything that needs to survive restarts

๐Ÿ—๏ธ Architecture

Database Structure

HyDB/
โ”œโ”€โ”€ global/              # Global databases
โ”‚   โ”œโ”€โ”€ economy.db       # Economy plugin
โ”‚   โ”œโ”€โ”€ stats.db         # Stats plugin
โ”‚   โ””โ”€โ”€ yourplugin.db    # Your plugin
โ””โ”€โ”€ worlds/              # Per-world databases
    โ”œโ”€โ”€ world1/
    โ”‚   โ””โ”€โ”€ claims.db
    โ””โ”€โ”€ world2/
        โ””โ”€โ”€ claims.db

Each plugin gets its own database file containing multiple tables, providing:

  • Complete data isolation
  • Easy backup/restore
  • Independent scaling
  • No table name conflicts

๐Ÿ“– Documentation

Included files:

  • README.md - Complete API documentation with examples
  • COMMANDS.md - Admin command reference
  • QUICK_START.md - Quick reference guide
  • EXAMPLE_USAGE.java - Full working example plugin
  • DATABASE_STRUCTURE.md - Architecture details

๐Ÿ”’ Safety Features

  • Read-Only Admin Commands - Query commands only allow SELECT/PRAGMA
  • SQL Injection Protection - Prepared statements throughout
  • Automatic Rollback - Transaction failures roll back automatically
  • Error Handling - Comprehensive error messages and logging

๐Ÿ› ๏ธ Technical Details

  • Language: Java 25 with modern features (virtual threads, switch expressions)
  • Database: SQLite 3.47.1.0 with JDBC
  • Build: Simple bash build script (no complex build tools)
  • Dependencies: Bundled (SQLite JDBC, SLF4J)
  • Size: ~14MB (includes all dependencies)

๐ŸŒŸ Why Use HyDB?

For Server Owners

โœ… Install once, benefits all plugins โœ… Centralized database management โœ… In-game debugging commands โœ… Better server performance (shared connection pooling)

For Plugin Developers

โœ… No database management code needed โœ… Simple, intuitive API โœ… Async operations prevent lag โœ… Well-documented with examples โœ… Schema migration support


๐Ÿ“Š Comparison

Feature HyDB JSON Files Custom DB Code
Easy to Use โœ… Simple API โœ… Very Simple โŒ Complex
Performance โœ… Fast โŒ Slow โœ… Fast
Queries โœ… SQL โŒ Limited โœ… SQL
Thread-Safe โœ… Yes โŒ No โš ๏ธ Depends
Async โœ… Built-in โŒ Manual โš ๏ธ Manual
Migrations โœ… Built-in โŒ Manual โš ๏ธ Manual
Transactions โœ… Built-in โŒ No โœ… Yes

๐Ÿš€ Example Plugins Using HyDB

The download includes a complete example plugin showing:

  • Database setup with migrations
  • Player data management
  • Transaction-based operations
  • Query builder usage
  • Best practices

๐Ÿ“ License

Open source - free to use for Hytale servers and plugin development.


๐Ÿค Support & Contributing

  • Issues: Report bugs or request features
  • Documentation: Comprehensive guides included
  • Examples: Working code samples provided

๐ŸŽ‰ Get Started Today!

  1. Install HyDB on your server
  2. Other plugins can immediately use the API
  3. Use /hydb commands for debugging and monitoring
  4. Enjoy reliable, fast database storage!

Version: 1.0.0 Compatibility: Hytale (current version) Mod Author: Oceride


Making data persistence simple and powerful for Hytale plugins! This is a required dependency / backend database mod.

Image Generated by GPT-4