Skip to content

Releases

v2.14.3 Added Redis Database

Choose a tag to compare

@tcmmi tcmmi released this 21 Mar 11:19

🔴 New: Redis Variable Storage

Skript variables can now be stored in Redis with instant cross-server sync via Pub/Sub (<5ms). Zero external Java dependencies - built using raw RESP protocol sockets.

Why Redis? MySQL syncs every 5-60 seconds by polling. Redis pushes changes instantly to every connected server. No polling. No delays. No race conditions.

Quick Start

1. Install Redis:

sudo apt install redis-server -y
sudo systemctl enable redis-server
sudo systemctl start redis-server
redis-cli ping  # -> PONG

2. Add to config.sk:

databases:
    database 1:
        type: Redis
        pattern: .*
        host: 127.0.0.1
        port: 6379
        password: ""

3. Restart your server. Variables sync instantly.

Redis vs MySQL

MySQL Redis
Sync Speed 5-60s (polling) <5ms (Pub/Sub)
Race Conditions Possible Impossible
Persistence Always on disk RAM + disk (RDB/AOF)
Setup Database + credentials apt install redis-server

Persistence

Redis saves to disk automatically via RDB snapshots. For maximum durability:

# /etc/redis/redis.conf
appendonly yes
save 60 1000

Redis Management

RedisInsight - free GUI for Redis:

docker run -d --name redisinsight --network host redis/redisinsight:latest
# Open http://your-server:5540

Requirements

  • Redis 6.0+ on the server
  • Default: 127.0.0.1:6379, no password

🟢 MySQL: SQLibrary Removed

The abandoned SQLibrary dependency has been replaced with direct JDBC connections via DatabaseWrapper. Works with MySQL Connector/J 8.x and 5.x. No more NoClassDefFoundError: lib/PatPeter/SQLibrary/Database.


🟡 MySQL: Automatic Schema Migration

Tables created by older Skript versions are now automatically upgraded on startup. Missing columns (update_guid, rowid) are added via ALTER TABLE - no manual SQL needed.


🟡 MySQL: Deadlock Protection

  • Save operations retry up to 3x with exponential backoff
  • Commit thread gracefully recovers from deadlocks
  • No more Deadlock found when trying to get lock error spam

🟡 MySQL: Connection Recovery

  • autoCommit and prepared statements automatically restored after reconnect
  • Eliminated duplicate connection threads
  • Connection keep-alive with automatic reconnection logging

v2.14.3 Fixed Cross Server Sync

Choose a tag to compare

@tcmmi tcmmi released this 21 Mar 01:37

Update to the MySQL fix with full multi-server variable sync support.


What's New

Multi-Server Variable Sync

Variables can now be synced between multiple servers via a shared MySQL database. Each server gets a unique identifier — when one server writes a variable, the others detect the change and update their in-memory state automatically.

Bug Fixes

  • Connection recovery: after a reconnect, autoCommit and all prepared statements (write, delete, monitor, cleanup) are now properly restored — previously sync would silently break after any connection interruption
  • No duplicate connections: open() now closes the old connection before creating a new one, preventing connection leaks
  • Reconnect logging: reconnect events are now logged (reconnected successfully! / reconnect failed!) instead of failing silently

Enable Sync

In config.sk on all servers that share the database:

databases:
    database 1:
        type: MySQL
        pattern: .*
        monitor changes: true
        monitor interval: 10 seconds
        host: your_host
        port: 3306
        user: your_user
        password: your_password
        database: your_database
        table: variables21

Important

Set pattern, monitor changes, and monitor interval to the same values on all servers sharing the database.

Recommended Intervals

Interval Sync Delay DB Load Use Case
5 seconds ~5s Higher Real-time critical (economy, ranks, live stats)
10 seconds ~10s Medium Recommended for most setups
20 seconds ~20s Low Default, safe choice for rarely changed data
60 seconds ~60s Minimal Config/settings sync only

Skript 2.14.3 - MySQL Fix

Choose a tag to compare

@tcmmi tcmmi released this 21 Mar 00:10

Drop-in replacement for Skript-2.14.3.jar that removes the ancient SQLibrary dependency and replaces it with direct JDBC connections.


The Problem

Skript 2.14.3 still requires the abandoned SQLibrary plugin (lib.PatPeter.SQLibrary) for MySQL variable storage. SQLibrary hasn't been updated in over 8 years and is no longer available for download - making MySQL-backed variables completely broken on modern Paper servers.

Symptoms:

java.lang.NoClassDefFoundError: lib/PatPeter/SQLibrary/Database
Could not establish MySQL connection: Attempted reconnect 3 times. Giving up.

The Fix

All SQLibrary references have been replaced with a lightweight DatabaseWrapper abstraction that connects directly via JDBC using the MySQL Connector/J driver already bundled with Paper.

What changed Details
Removed All lib.PatPeter.SQLibrary imports & dependencies
Added DatabaseWrapper.java - abstract JDBC base class
Added MySQLDatabase.java - MySQL connection via DriverManager
Added SQLiteDatabase.java - SQLite connection via DriverManager
Modified SQLStorage.java - keep-alive & transaction threads fixed
Modified MySQLStorage.java - uses DatabaseWrapper
Modified SQLiteStorage.java - uses DatabaseWrapper

Connection Features:

  • useSSL=false + allowPublicKeyRetrieval=true (MySQL 8.x compatible)
  • Connect timeout: 10s, Read timeout: 30s
  • Auto-detection of MySQL Connector/J 8.x and 5.x drivers
  • Detailed error diagnostics (SQLState, ErrorCode, Root Cause)

Installation

  1. Download Skript-2.14.3-fixed.jar below
  2. Replace your existing Skript-2.14.3.jar in plugins/
  3. Delete SQLibrary from plugins/ - it's no longer needed
  4. Grant MySQL permissions for TCP connections:
GRANT ALL PRIVILEGES ON skript.* TO 'your_user'@'127.0.0.1';
FLUSH PRIVILEGES;
  1. Restart the server

Important

Your config.sk database section does not need any changes. The same format as before is used.


Compatibility

Server Status Notes
Paper / Purpur / Folia Works out of the box MySQL Connector/J is bundled
Spigot / CraftBukkit Requires extra step MySQL driver must be added manually (see below)

Spigot / CraftBukkit Setup

Spigot does not bundle the MySQL JDBC driver. Download it manually and place it in your server's classpath:

  1. Download mysql-connector-j-9.2.0.jar from Maven Central
  2. Place it in your server root directory (next to spigot.jar)
  3. Add it to your startup command:
java -cp spigot.jar:mysql-connector-j-9.2.0.jar org.bukkit.craftbukkit.Main

Or alternatively, place it inside the plugins/ folder — some server implementations will pick it up from there.

Tested With

Component Version
Paper 1.21.11
Java 17+ (tested with 23.0.2)
MySQL 5.7+ / 8.x (Connector/J 8.3.0 & 9.2.0)
MariaDB 10.3+
Skript 2.14.3

Source

All modified .java source files are available in the src/ directory of this repository.

This patch follows the same license as Skript (GPL-3.0).