Skip to content

Conversation

@imDMK
Copy link
Owner

@imDMK imDMK commented Nov 29, 2025

Description

This PR delivers a full, project-wide overhaul of the plugin.
It redesigns the architecture, boosts performance, simplifies internals, enhances maintainability, and introduces a complete modern API layer.
It also adds full modular database support and significantly reduces operational overhead.


🔧 Architecture & Code Quality

  • Fully refactored project structure for clarity and maintainability.
  • Migrated to dependency injection via the PandaLang Injector.
  • Rewritten service layer, repository layer, module lifecycle, and task scheduling.
  • Introduced clear API / implementation separation.
  • Added new utility subsystems:
    • time formatting
    • placeholders
    • adventure component utilities
    • validation
    • caching
    • scheduler abstractions

⚡ Performance Enhancements

  • Converted heavy operations to async where safe.
  • Implemented Caffeine-based caching for user aggregates.
  • Added memory-based top-users cache to avoid repeated DB aggregation.
  • Improved thread-safety; reduced synchronization overhead.
  • Removed redundant logic and streamlined core service calls.

💾 Database Support

Added full support for major SQL engines:

  • H2 (embedded)
  • MySQL
  • SQLite
  • MariaDB
  • PostgreSQL
  • Microsoft SQL Server

Additional improvements:

  • Dynamic JDBC driver loading → smaller JAR
  • Rebuilt ORMLite repository layer with async pipelines & clean error handling

🧹 JAR Size & Runtime Optimization

  • Removed bundled drivers (loaded on demand)
  • Reduced unused code and dependencies
  • Improved class layout and module structure

🎨 New API & Developer Experience

  • Introduced a clean, modern public API layer.
  • Added:
    • UserSaveReason
    • PluginTask
    • high-level abstractions for scheduling and user operations
  • Improved User, UserService, and repository interfaces.

🕒 Duration Formatting Improvements

  • Added multiple formatting styles:
    • COMPACT, LONG, LONG_WITH_AND, NATURAL
  • Introduced full formatting & conversion utilities.
  • Strict validation + normalization.

🧮 Top Users Cache

  • Added TopUsersCache for instant leaderboard lookups.
  • Configurable expiration and limits.
  • Consistent invalidation strategy.

🏷️ Project Rename

  • Renamed plugin: SpentTime → AdvancedPlayTime
  • Updated:
    • packages
    • config files
    • plugin metadata
    • public API references

Result

  • Smaller JAR
  • Faster runtime
  • Cleaner architecture
  • Extensible DB layer
  • Production-grade performance

Fixes: #108


Have the changes been tested?

  • Yes
  • No

@imDMK imDMK merged commit e570ed8 into main Nov 29, 2025
1 check passed
@imDMK imDMK deleted the refactor/major-codebase-overhaul branch November 29, 2025 13:46
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.

PostgreSQL support

2 participants