ArcanePlugins / ArcanePlugins/Treasury

Breaking Change Proposals ('Treasury v3')

Open
#287 0 comments 0 reactions 0 assignees View on GitHub
priority: low status: on hold status: unconfirmed type: improvement unassigned developers unassigned target version
Dominant language
Java
Stars
61
Forks
15
PR merge metrics
No merged PRs in 30d

Description

__Nobody is in the mood to make another breaking change to Treasury__, though if we ever need to make one in the distant future, it would be best to make as many of these breaking changes all in one go to reduce the burden to implementers.

To avoid clogging up our issue tracker, I'd prefer to group these suggestions here.

Without further ado, let's look at the current proposals. Please add your vote in the comments.

***

Proposal: Adjust return type of EconomyProvider#registerCurrency from TriState to Boolean


### Description

There is no purpose for the third state, `FALSE`, in the `TriState` that is returned from [`EconomyProvider#registerCurrency`](https://jd.mrivanplays.com/treasury/api/me/lokka30/treasury/api/economy/EconomyProvider.html#registerCurrency(me.lokka30.treasury.api.economy.currency.Currency)). `TRUE` is used for 'it worked', `UNSPECIFIED` is used for 'it was already registered', and an exception should be thrown in the overlapping `CompletableFuture` returned if the currency couldn't be registered, leaving zero purpose for the `FALSE` state.

Therefore, I recommend we simply switch the return type to `Boolean` so that `TriState#TRUE` is represented by a `true` value and `TriState#UNSPECIFIED` is represented by a `false` value (so that the boolean returned is a question of whether the currency was not already registered).

### Voting

- Yay: lokka30
- Nay:

***

Sketchpad of ideas that need to be described and added above:

- [`deleteAccount`](https://jd.mrivanplays.com/treasury/api/me/lokka30/treasury/api/economy/account/Account.html#deleteAccount()) should return nothing (`void`), the boolean result `false` is meaningless since an exception should be thrown if the deletion doesn't go through.

***

*Any further proposals? Add yours below and I'll pop it in here. Your vote counts too - add yours in the comments.*

Contributor guide

Open the contributing guide

Research direction

Review the proposals in the issue, starting with EconomyProvider#registerCurrency and the linked API documentation, then consider the Account#deleteAccount sketch. This is a voting and design thread rather than an implementation task; it is done only once proposals are described, approved, and coordinated as a breaking API change.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.