Skip to content

Conversation

NonSwag
Copy link
Member

@NonSwag NonSwag commented Jul 19, 2025

Supersedes #63

NonSwag added 27 commits August 28, 2025 17:38
Replaced `ServiceBankController` and `ServiceEconomyController` with `BankControllerDelegate` and `EconomyControllerDelegate` for improved modularity and currency support.
Improved handling of `Currency` in account management, balance calculations, and command messages. Replaced redundant methods in `EconomistEconomyController` and adjusted SQL queries to respect currency.
Introduced `setupDatabase` method to centralize table creation for accounts, banks, and triggers. Removed redundant account-deleting methods in favor of a streamlined `prune` implementation. Updated commands to leverage `prune` for improved efficiency and simplicity.
Included SQLite database migration to `v1`, added `balances` table, and improved schema for `accounts`, `banks`, and `currencies`. Refactored `EconomistAccount` and `EconomistBank` for better balance handling and consistency. Updated commands, listeners, and controllers to align with new schema and logic.
Updated `balances` field to use `Currency` as key, replaced `getBalances` return type with unmodifiable map, and adjusted balance retrieval logic for consistency. Added Javadoc to clarify behavior of `getBalances`.
Introduced `markDirty` and `saveDirty` methods in controllers to optimize saving only modified accounts and banks. Updated `EconomistAccount` and `EconomistBank` to track changes automatically.
Introduced `getAccountsUpdatedSince` for incremental database sync, synchronized accounts at regular intervals, and enhanced account caching logic. Updated configurations for auto-saving and synchronization intervals. Added supporting SQL query and refactored relevant controllers.
Replaced the `MySQL` entry in `StorageType` enumeration with `MariaDB` to reflect the supported database options.
Eliminated the unused `MongoDB` option in the `StorageType` enumeration to reflect the supported storage solutions.
Introduced `PostgreSQLController` as a new `DataController` option. Updated configuration handling to include PostgreSQL in `storageType`. Preparation for future PostgreSQL implementation.
Introduced a reminder to enhance the query by supporting filtering by currency and optionally by world.
Reordered fields to align with conventions and added `@Nullable` annotation for batch parameters in `executeBatchUpdate`. Adjusted spacing and cleaned up unused lines.
Replaced `Optional`-based lookup with streamlined `stream().anyMatch` for better readability and performance.
Ensured the default currency is added to the list during initialization. Added a TODO comment to handle deletion of the default currency properly.
Removed `mavenLocal` from repositories to clean up build configuration and updated `service-io` version to the latest pre-release. This ensures compatibility with new features and fixes.
Introduced methods to verify deposit and withdrawal capabilities based on currency compatibility. Enhanced balance manipulation logic for better validation using `canHold`.
Included the `https://repo.thenextlvl.net/snapshots` repository in `build.gradle.kts` to enable dependency resolution for snapshot versions.
Reintroduced the accidentally removed method that retrieves all balances as an unmodifiable map. Updated its documentation for clarity.
Implemented methods to verify if accounts and banks can handle specific currencies and transactions. These changes improve validation and ensure compliance in balance operations.
Configured `tasks.javadoc` to include custom tags (`apiNote`, `implSpec`) and made `test` depend on `javadoc`. Improvements ensure better API documentation generation.
Relocated `tasks.javadoc` and its dependencies to `api/build.gradle.kts` for better separation of build logic between core and API modules.
Moved task scheduling logic to a public `scheduleTasks` method in `EconomistEconomyController`. This ensures tasks are explicitly initiated during the plugin's `onEnable` phase.
Added a check in `deleteCurrency` to ensure the default currency cannot be deleted. Updated Javadocs to reflect this behavior.
Cleaned up redundant comment referencing outdated functionality.
Specified mutability and purity contracts for better static analysis and code documentation.
Refactored `SQLiteController` for enhanced batch operations and added support for multiple SQL statements. Introduced currency-specific arguments in commands and updated database schema to handle multiple currencies.
Refactored commands to include `currency` as an argument, enabling multi-currency handling in balance operations. Default currency is used when none is specified.
The `id` column now acts as a regular foreign key referencing the `accounts` table. This change allows more flexible relationships and adheres to updated schema requirements.
Introduced a query to reset the `last_update` field in the `accounts` table for specified `uuid` and `world`, enhancing data consistency.
Simplified SQL by removing unused WITH clause and `accounts` update logic. Enhanced readability and maintained functionality with optimized subquery.
Updated the catch block in `pullChangesFromDatabase` to include `lastSyncTime` in error logs for better debugging context.
Replaced `forEach` with `removeIf` to streamline account saving and clearing operations.
Introduced a unified `Executor` for SQL operations to simplify transaction management. Updated methods across controllers to use `startTransaction` for improved consistency and maintainability.
Updated variable initialization to use "abbreviations" as the correct key namespace, ensuring alignment with intended use and avoiding potential mismatches.
Extended error handling in `SQLiteController` to include `SQLITE_CONSTRAINT_TRIGGER` cases, improving robustness during account creation.
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