Skip to content

HyLeveling Configuration

AzureDoom edited this page Dec 27, 2025 · 2 revisions

Database Configuration

The database section controls how HyLeveling stores player data such as UUID and experience.

Supported JDBC URLs

Database Example JDBC URL
H2 (file) jdbc:h2:file:./hyleveling/hyleveling;MODE=PostgreSQL
MySQL jdbc:mysql://host:3306/dbname
MariaDB jdbc:mariadb://host:3307/dbname
PostgreSQL jdbc:postgresql://host:5432/dbname

Notes

  • H2 typically uses an empty username and password unless explicitly configured.
  • MySQL, MariaDB, and PostgreSQL require valid credentials.

Example Configuration

database:
  jdbcUrl: "jdbc:h2:file:./hyleveling/hyleveling;MODE=PostgreSQL"
  username: ""
  password: ""
  maxPoolSize: 10

Options

jdbcUrl

  • Type: String
  • Description: JDBC connection string used to connect to the database.
  • Default: H2 file database in the plugin data directory.

username

  • Type: String
  • Description: Database username.
  • Required: Yes for MySQL, MariaDB, and PostgreSQL.

password

  • Type: String
  • Description: Database password.
  • Required: Yes for MySQL, MariaDB, and PostgreSQL.

maxPoolSize

  • Type: Integer
  • Description: Maximum number of database connections in the connection pool.
  • Default: 10

Migration Notes

  • Switching between database types (H2, MySQL, MariaDB, PostgreSQL) does not support automatic data migration.
  • HyLeveling will treat the new database as empty unless data is manually transferred.
  • Always back up your existing database before modifying JDBC settings.

Leveling Formula

The formula section defines how much XP is required to reach each level.

Supported Formula Types

Type Description
EXPONENTIAL XP increases exponentially as levels increase
LINEAR Fixed XP increase per level
TABLE XP values are loaded from a CSV file
CUSTOM XP is calculated using a math expression

Global Options

formula:
  type: "EXPONENTIAL"
  migrateXP: true

type

  • Allowed Values: EXPONENTIAL, LINEAR, TABLE, CUSTOM

migrateXP

  • Type: Boolean
  • Default: true
  • Description: Recalculates stored XP when the formula changes to preserve player levels.

Exponential Formula

exponential:
  baseXp: 100.0
  exponent: 1.7

Formula

XP(level) = baseXp * (level - 1) ^ exponent

Linear Formula

linear:
  xpPerLevel: 100

Formula

XP(level) = xpPerLevel * (level - 1)

Table Formula (CSV)

The TABLE formula allows you to explicitly define XP floors per level using a CSV file.

Example Configuration

table:
  file: "levels.csv"

CSV Format

  • One row per level
  • Two columns: level,xp
  • Levels must start at 1
  • XP represents the XP floor required to reach that level

Example levels.csv

level,xp
1,0
2,100
3,250
4,450
5,700
6,1000

Notes

  • Missing levels are not allowed
  • Levels must be sequential
  • XP values must be increasing
  • This method gives full manual control over progression

Custom Formula

The CUSTOM formula allows defining XP requirements using a mathematical expression.

Example Configuration

custom:
  xpForLevel: "exp(a * (level - 1)) * b"
  constants:
    a: 0.15
    b: 100
  maxLevel: 100000

Expression Rules

  • The expression must return the XP floor for a level
  • Expressions are evaluated using floating-point math

Available Variables

Variable Description
level Current level (integer ≥ 1)

Constants

Constants are user-defined numeric values you can reference inside the expression.

constants:
  a: 0.15
  b: 100

Example Calculations

For the example above:

  • Level 1 → exp(0) * 100 = 100
  • Level 10 → exp(0.15 * 9) * 100 ≈ 386
  • Level 50 → exp(0.15 * 49) * 100 ≈ 22255

maxLevel

  • Type: Integer
  • Description: Maximum supported level for this formula.
  • Purpose: Used internally for binary search and XP calculations.
  • Recommendation: Set this higher than the maximum level your server will ever reach.

Migration Notes

  • Changing formula types with migrateXP enabled will preserve player levels.
  • Disabling migration will keep raw XP values unchanged.
  • Always back up your data before switching formulas.