Skip to content

v3 API improvements, multi currency support #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open

v3 API improvements, multi currency support #117

wants to merge 31 commits into from

Conversation

NonSwag
Copy link
Member

@NonSwag NonSwag commented Jul 15, 2025

Closes #39

  • add currency based placeholders
  • implement currency conversion (convert command)
  • add @since to all docs
  • minimize controller implementation overhead

NonSwag added 16 commits July 14, 2025 19:43
Updated version in `build.gradle.kts`.
Introduced `CurrencyHolder` to centralize currency management logic. Applied the interface to `EconomyController`, `BankController`, and related classes to unify and enhance functionality. Deprecated older currency formatting methods in favor of `Currency` methods.
Introduced `Currency` interface to define currency properties and formatting. Deprecated older `EconomyController` methods in favor of `Currency` methods for better consistency and multi-currency support.
Replaced direct balance manipulation methods with `Currency`-based equivalents for consistency and multi-currency support. Deprecated older methods and introduced `WrappedCurrency` for compatibility with Vault's economy API. Updated placeholders and wrapper classes accordingly.
Outlined areas for improvement, including API cleanup, error handling, data loss warnings, and progress tracking.
Updated deprecation annotations to mark methods for removal in version 3.0.0. Added `@since 3.0.0` annotations to newly introduced methods in `CurrencyHolder`.
Enhanced method contracts with `@Contract` annotations to improve nullability and immutability handling while clarifying method behaviors.
Refactored `EconomyController` and `BankController` methods to include `@Nullable` `World` parameters. Adjusted method signatures and default behaviors to accommodate this change.
Introduced `hasMultiWorldSupport` method in `EconomyController` and `BankController`. This determines multi-world handling capabilities and clarifies parameter behavior for non-supported cases.
Enhanced documentation across `EconomyController` and `CurrencyHolder`. Clarified behaviors, improved annotations, and ensured consistent descriptions for return values and exceptions.
Updated methods to use `getHolder` for consistency with the `CurrencyHolder` interface.
Replaced `try-catch` blocks with streamlined `join` and `Optional` chaining for cleaner and more concise code. Eliminated imports for `InterruptedException` and `ExecutionException`.
Eliminated unused `deleteAccounts` method and corresponding import to streamline the `EconomyServiceWrapper` class.
Replaced unfinished bank and account conversion workflows with `CompletableFuture.completedFuture(null)`. Added TODOs and FIXMEs to address unresolved implementation details.
Documented the version in which interfaces, methods, and classes were introduced.
@NonSwag NonSwag self-assigned this Jul 15, 2025
@NonSwag NonSwag added the enhancement New feature or request label Jul 15, 2025
NonSwag added 12 commits July 15, 2025 21:54
Refactored controllers and related methods to support `@Nullable World` parameters. Adjusted method signatures and default behaviors, introducing helper methods for context handling. This simplifies multi-world and default-world operations.
Introduced `displayNamesSingular()` and `displayNamesPlural()` methods in `Currency.Builder`. These provide unmodifiable mappings of singular and plural display names for various locales, improving extensibility and localization support.
Updated `Currency` interface methods to return `Optional` values, improving null safety. Added builders and editing functionalities. Enhanced `Account` methods for simpler balance operations, with `BigDecimal` returns for precision. Bumped version to 3.0.0-pre2.
Updated `Currency` methods to return `Optional`, improving null safety. Redesigned `setBalance` in `WrappedAccount` to return `BigDecimal` for better precision. Adjusted `WrappedCurrency` to include editing logic and improve locale-based display name handling for currencies. Bumped version to 3.0.0-pre3.
Declared `throws IllegalArgumentException` for `editCurrency` to handle duplicate currency names explicitly. This improves API safety and clarity for consumers.
Introduced a default method to delete currencies using their object reference. Delegates internally to `deleteCurrency(String)` for streamlined logic and API flexibility.
Added a `toBuilder` method to the `Currency` interface and implemented it in `WrappedCurrency` using a `NoOpBuilder`. This allows modification or reconstruction of a `Currency` instance.
Refactored `EconomyController`, `BankController`, and related APIs to delegate currency management to `CurrencyHolder`. Removed deprecated methods from `Account` and `CurrencyHolder`. Updated implementations and placeholder resolvers to align with the changes. Bumped version to 3.0.0-pre4.
Expanded `BankController` with multiple `hasBank` overloads for better account-checking flexibility. Updated `Currency` to include `getHolder`, improving association tracking. Adjusted wrappers to align with these changes.
Replaced `UnsupportedOperationException` with a fully implemented method. Leveraged builder details for initializing currency attributes such as names, fractional digits, and symbols. Simplified creation logic and enhanced API usability.
Enhanced descriptions for method parameters, added `@apiNote` annotations for clarity, and standardized return value formatting with `{@code}`. Updated references to `uuid` instead of `UUID`. Improved consistency in `Account` API behavior with `BigDecimal.ZERO` returns for unsupported operations.
NonSwag added 3 commits July 22, 2025 20:44
Enhanced `Bank` and `Account` APIs with balance operation checks. Implemented default behaviors and updated wrappers to align with the new methods for consistent validation logic.
Documented version information for newly introduced methods in `Bank` and `Account` to improve clarity and maintainability.
Updated project version in `build.gradle.kts` to reflect the latest pre-release iteration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple Currencies Support
1 participant