Welcome to Hytalib, the lightweight helper library made to power clean, scalable Hytale server plugins.
It gives you config handling, database utilities, logging, builders, and common helpers β without bloat.
Add Hytalib to your Gradle/Maven project:
Gradle
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.HytaLab:hytalib:VERSION'
}
Maven
<repositories>
<repository>
<id>jitpack</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.HytaLab</groupId>
<artifactId>hytalib</artifactId>
<version>VERSION</version>
</dependency>
</dependencies>
If you're working on the library itself, simply clone the repo and open it in IntelliJ.
- Open IntelliJ
- New Project β Gradle β Java
- Set Java version (21+ recommended) Will change to 24
- Add the Gradle dependency above
- Reload Gradle
- Create your first plugin class
Every plugin extends PluginBase.
public class ExamplePlugin extends PluginBase {
@Override
public void onLoad() {
super.onLoad("ExamplePlugin");
}
@Override
protected void onEnable() {
getLogger().info("ExamplePlugin has started!");
}
@Override
protected void onDisable() {
getLogger().info("ExamplePlugin is shutting down...");
}
}PluginBase gives you:
- A built-in logger
- An easy plugin lifecycle
- Auto registration of plugin name
- Clean structure for startup and shutdown
Hytalib ships with a minimal, fast config loader built on SnakeYAML.
Configuration config = new Configuration(Paths.get("plugins/ExamplePlugin/config.yml"));config.getString("host");
config.getInt("port");
config.getBoolean("feature.enabled");
// All getters have a built-in safe fallback:
String value = config.getString("missing.key"); // returns null safelygetString(key)getInt(key)getBoolean(key)getDouble(key)getLong(key)getList(key)getMap(key)
Defaults are optional β missing values simply return null.
Hytalib supports:
- MySQL
- SQLite
- H2
- PostgreSQL (soon)
- Redis (via Jedis)
database = DatabaseBuilder.create()
.type(DatabaseTypes.MYSQL)
.host(config.getString("data.host"))
.port(config.getInt("data.port"))
.database(config.getString("data.database"))
.user(config.getString("data.username"))
.password(config.getString("data.password"))
.maxPoolSize(20)
.build();database = DatabaseBuilder.create()
.type(DatabaseTypes.SQLITE)
.filePath("plugins/ExamplePlugin/data.db")
.build();DatabaseBuilder automatically:
- Creates a HikariDataSource
- Applies safe defaults
- Validates missing fields
- Provides pooled connections
public class UserData {
private final UUID uuid;
private String name;
private int coins;
public UserData(UUID uuid, String name, int coins) {
this.uuid = uuid;
this.name = name;
this.coins = coins;
}
}public class UserRepository {
private final Database db;
public UserRepository(Database db) {
this.db = db;
}
public void createTable() throws SQLException {
try (var conn = db.getConnection();
var stmt = conn.createStatement()) {
stmt.executeUpdate("""
CREATE TABLE IF NOT EXISTS users (
uuid VARCHAR(36) PRIMARY KEY,
name VARCHAR(32),
coins INT
);
""");
}
}
}public class ExamplePlugin extends PluginBase {
private static ExamplePlugin instance;
private Configuration config;
private Database database;
@Override
public void onLoad() {
super.onLoad("ExamplePlugin");
}
@Override
protected void onEnable() {
instance = this;
config = new Configuration(Paths.get("plugins/ExamplePlugin/config.yml"));
if (config.getBoolean("data.sql-enabled")) {
database = DatabaseBuilder.create()
.type(DatabaseTypes.MYSQL)
.host(config.getString("data.host"))
.port(config.getInt("data.port"))
.database(config.getString("data.database"))
.user(config.getString("data.username"))
.password(config.getString("data.password"))
.maxPoolSize(20)
.build();
}
getLogger().info("Example plugin enabled.");
}
@Override
protected void onDisable() {
if (database != null) database.close();
}
public static ExamplePlugin getInstance() {
return instance;
}
public Configuration getConfig() {
return config;
}
}NumberUtils.isInt("123");
NumberUtils.isDouble("3.14");
NumberUtils.format(1500); // "1,500"
NumberUtils.round(3.14159, 2);- Safe loading
- Auto-creating missing files
- Includes optional default-saving
src/
ββ main/
ββ java/
ββ dev/
ββ team/
ββ hytalib/
ββ core/
ββ db/
ββ utils/
ββ config/
ββ examples/
Open an issue or discussion.
This project exists for developers like you.
You now have a fully functional foundation for serious Hytale plugin development.
Happy coding! π