Skip to content

Add expiring temporary points support - #92

Open
LDS-XiaoYe wants to merge 2 commits into
Rosewood-Development:masterfrom
mcstaralliance:master
Open

LDS-XiaoYe wants to merge 2 commits into
Rosewood-Development:masterfrom
mcstaralliance:master

Conversation

@LDS-XiaoYe

Copy link
Copy Markdown

Overview

This PR adds expiring temporary points alongside the existing permanent points balance.

Temporary points are stored in independent batches with their own expiration timestamps. Existing point balances remain permanent and are not modified during migration.

Changes

  • Added automatic database migration for the temporary_points table
  • Added support for multiple temporary point batches with independent expiration times
  • Updated regular point deductions to consume the earliest-expiring temporary points first, then permanent points
  • Added separate management commands:
    • /points temporary give <player> <amount> <duration>
    • /points temporary take <player> <amount>
    • /points temporary set <player> <amount> <duration>
    • /points temporary reset <player>
    • /points temporary look <player>
    • /points permanent give|take|set|reset|look
  • Added duration formats such as 30m, 12h, 7d, and 1w2d
  • Updated /points look and /points me to display:
    • Total points
    • Permanent points
    • Temporary points
    • Next expiration time
  • Added a login reminder showing the player's temporary balance and the number of days until the next batch expires
  • Added API methods for managing and querying permanent and temporary balances
  • Added PlaceholderAPI placeholders:
    • %playerpoints_temporary_points%
    • %playerpoints_temporary_points_formatted%
    • %playerpoints_temporary_points_shorthand%
    • %playerpoints_temporary_expiration%
    • %playerpoints_temporary_expiration_formatted%
    • %playerpoints_permanent_points%
    • %playerpoints_permanent_points_formatted%
    • %playerpoints_permanent_points_shorthand%
  • Existing %playerpoints_points% placeholders now return the combined balance
  • Leaderboards remain based on permanent points to prevent temporary grants from affecting long-term rankings
  • Added English and Simplified Chinese locale messages
  • Added separate permissions for permanent and temporary point management

Database Compatibility

The migration only creates a new temporary-points table and index. Existing permanent point tables and balances are left unchanged.

Both SQLite and MySQL are supported, and the migration runs automatically when upgrading.

Validation

  • ./gradlew clean build
  • YAML locale validation
  • SQLite schema validation

The project builds successfully on Java 8 compatibility settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant