Skip to content

Database Documentation

Supported Backends

BackendClassDefault
SQLiteSQLiteDatabase✅ Yes
MySQL/MariaDBMySQLDatabaseOptional

Configuration: config.ymldatabase.type (SQLITE or MYSQL)

Connection Pooling

MySQL connections use HikariCP with configurable pool settings:

  • maximumPoolSize (default: 10)
  • minimumIdle (default: 2)
  • connectionTimeout (default: 30000ms)

Schema

All tables use a configurable prefix (default: lc_).

lc_claim_profiles

Primary table for claim profile metadata.

ColumnTypeConstraintsDescription
owner_idVARCHAR(36)PRIMARY KEYOwner's UUID
nameVARCHAR(64)NOT NULLDisplay name
claim_colorVARCHAR(16)NULLABLEHex color (e.g., #00FF00)
vis_modeVARCHAR(32)DEFAULT 'DISPLAY_ENTITY'Visualization mode
title_enabledBOOLEANDEFAULT FALSEEntry/exit title toggle
enter_titleVARCHAR(255)NULLABLEMiniMessage enter title
leave_titleVARCHAR(255)NULLABLEMiniMessage leave title

lc_claimed_chunks

Stores all claimed chunk positions.

ColumnTypeConstraintsDescription
chunk_idVARCHAR(128)PRIMARY KEYFormat: world:x:z
owner_idVARCHAR(36)NOT NULL, INDEXFK → claim_profiles.owner_id

lc_profile_roles

Custom roles defined per profile.

ColumnTypeConstraintsDescription
idVARCHAR(36)PRIMARY KEYRole UUID
owner_idVARCHAR(36)NOT NULL, INDEXFK → claim_profiles.owner_id
nameVARCHAR(64)NOT NULLRole name (case-insensitive key)
priorityINTNOT NULLLower = higher priority
flagsTEXTNOT NULLComma-separated permission flags

lc_profile_trusted_players

Per-player permission overrides.

ColumnTypeConstraintsDescription
owner_idVARCHAR(36)NOT NULLFK → claim_profiles.owner_id
player_idVARCHAR(36)NOT NULLTrusted player's UUID
flagsTEXTNOT NULLComma-separated permission flags
PRIMARY KEY (owner_id, player_id)

lc_profile_visitor_flags

Base permission layer for all non-members.

ColumnTypeConstraintsDescription
owner_idVARCHAR(36)NOT NULLFK → claim_profiles.owner_id
flagVARCHAR(64)NOT NULLPermission flag name
PRIMARY KEY (owner_id, flag)

lc_profile_member_roles

Player-to-role assignments within a profile.

ColumnTypeConstraintsDescription
owner_idVARCHAR(36)NOT NULLFK → claim_profiles.owner_id
player_idVARCHAR(36)NOT NULLMember's UUID
role_nameVARCHAR(64)NOT NULLAssigned role name
PRIMARY KEY (owner_id, player_id)

lc_profile_ally_flags

Allied claim relationships with per-ally permissions.

ColumnTypeConstraintsDescription
owner_idVARCHAR(36)NOT NULLFK → claim_profiles.owner_id
ally_idVARCHAR(36)NOT NULLAllied profile owner's UUID
flagsTEXTNOT NULLComma-separated permission flags
PRIMARY KEY (owner_id, ally_id)

lc_players

Player preference data.

ColumnTypeConstraintsDescription
uuidVARCHAR(36)PRIMARY KEYPlayer's UUID
auto_claimBOOLEANDEFAULT FALSEAuto-claim toggle
auto_unclaimBOOLEANDEFAULT FALSEAuto-unclaim toggle
vis_modeVARCHAR(32)DEFAULT 'DEFAULT'Preferred visualization
bonus_claim_blocksINTDEFAULT 0Bonus claim limit

lc_warps

Warp teleport points.

ColumnTypeConstraintsDescription
owner_idVARCHAR(36)NOT NULLProfile owner UUID
nameVARCHAR(64)NOT NULLWarp name (lowercase)
worldVARCHAR(64)NOT NULLWorld name
xDOUBLENOT NULLX coordinate
yDOUBLENOT NULLY coordinate
zDOUBLENOT NULLZ coordinate
yawFLOATNOT NULLYaw rotation
pitchFLOATNOT NULLPitch rotation
iconVARCHAR(64)NOT NULLMaterial name for icon
PRIMARY KEY (owner_id, name)

Legacy Tables (V1 Migration)

These tables exist for backward compatibility with the V1 → V2 migration:

TableStatus
lc_claimsDeprecated — migrated to profiles
lc_claim_chunksDeprecated — use claimed_chunks
lc_claim_membersDeprecated — use profile_member_roles
lc_claim_trustedDeprecated — use profile_trusted_players

DAO Architecture

ProfileDao (interface)
    └── SQLProfileDao (implementation)

ClaimDao (interface, legacy)
    └── SQLClaimDao (implementation)

PlayerDao (interface)
    └── SQLPlayerDao (implementation)

RoleDao (interface)
    └── SQLRoleDao (implementation)

WarpDao (interface)
    └── SQLWarpDao (implementation)

All DAO operations return CompletableFuture<T> for async execution. The DatabaseManager routes to the correct implementation based on the configured database type.

Save Strategy

SQLProfileDao.saveProfile() uses a clear-and-reinsert strategy within a transaction:

BEGIN TRANSACTION
  1. UPSERT claim_profiles row
  2. DELETE FROM claimed_chunks WHERE owner_id = ?
  3. INSERT claimed_chunks (batch)
  4. DELETE FROM profile_visitor_flags WHERE owner_id = ?
  5. INSERT profile_visitor_flags (batch)
  6. DELETE FROM profile_trusted_players WHERE owner_id = ?
  7. INSERT profile_trusted_players (batch)
  8. DELETE FROM profile_roles WHERE owner_id = ?
  9. INSERT profile_roles (batch)
  10. DELETE FROM profile_member_roles WHERE owner_id = ?
  11. INSERT profile_member_roles (batch)
  12. DELETE FROM profile_ally_flags WHERE owner_id = ?
  13. INSERT profile_ally_flags (batch)
COMMIT

This approach is simple and ensures consistency, at the cost of more writes. For profiles with many chunks/members, consider batching optimizations in future versions.

Cross-Server Sync (Redis)

When Redis is enabled, cache invalidation messages are published after DB writes:

Publish → landclaim:sync → "INVALIDATE_PROFILE:<owner_uuid>"

All servers subscribe and invalidate their local Caffeine cache on receipt.

Released under the MIT License.