-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Added Reserve Support, and tested. #2601
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
Added Reserve Support, and tested. #2601
Conversation
|
Screenshots of the implementation working:
|
|
Not sure why you PR'd this to Essentials, the implementation for your API goes inside of your plugin, not inside a different plugin |
|
The implementation goes inside each individual plugin, as Vault does with new plugins. The idea of putting each implementation inside my plugin would be like sponge putting each economy plugin inside their releases, which is far from ideal. Essentials was added into Vault before they forced each economy provider to make their own file inside their plugins, but generally i want to keep Reserve as lightweight as possible. |
|
Any updates on this? |
|
I don't currently have time to review and merge PRs, but when I get a chance I'll look at this. |
Ichbinjoe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly nits, requested change in pom.xml I feel is mandatory since putting the repository first opens up anyone building EssX to a dependency poison attack.
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
|
Ah darn it, meant to press request changes. |
Ichbinjoe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see above review regarding problems.
…h-reserve-support # Conflicts: # Essentials/src/com/earth2me/essentials/Essentials.java # Essentials/src/com/earth2me/essentials/register/payment/methods/ReserveEco.java
mdcfe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this is code style issues, but there's also a lot of duplication.
|
I like the look of the API overall - while EssentialsX doesn't take advantage of it, I appreciate the first-class support for async calls and multiple currencies, as well as the use of UUIDs not One concern I have: how are plugins supposed to create accounts for use that don't belong to players? For example, Towny has town balances, factions plugins have a balance for each faction, Citizens NPCs may have balances, and there are other countless examples of "banks" or shared accounts that aren't directly tied to a user. Do we just randomly generate a UUID and hope it doesn't clash? Do we create an account with a String and prepend some sort of namespace? Or are UUIDs and String identifiers always assumed to be associated with a player? On another note, I'm concerned that simply returning Firstly, a transaction might fail for a simple reason, such as it would place the account balance above the maximum balance or below the minimum (eg However, there might be less obvious issues with a transaction, like a plugin trying to add to a account that doesn't exist yet. There's currently no way for the calling plugin to know exactly what went wrong, only that the transaction failed. If this was exposed, the calling plugin could respond by setting up accounts and trying again or by informing users/administrators "hey, you need to do X". Another thing to consider is the possibility that the provider plugin could encounter an internal error while processng the transaction. Economy providers work in many different ways; if a database connection fails, the provider plugin may not be able to do anything, or perhaps the plugin is just encountering some other internal issue that prevents the call succeeding. The calling plugin may want to catch this and show a stack trace to ease the process of identifying and rectifying the issue. Finally, the provider plugin may choose not to implement all of the features of a Reserve economy service (such as in this case with . The calling plugin may want to disable some of its features if the economy provider doesn't support all Reserve features. These could be represented by either returning a response object that could indicate success/failure (like Vault's Furthermore, for optional features/capabilities/whatever you choose to call them, you could add an enum of feature flags to the API, and the provider can expose a I'm aware this is a big change to consider for the API, but if Reserve is intended as a replacement for Vault in the long term, it needs to be able to match and improve upon the capabilities of Vault or there simply won't be any reason for developers to support Reserve. edit: clarity + Vault source code link |
|
"One concern I have: how are plugins supposed to create accounts for use that don't belong to players? For example, Towny has town balances, factions plugins have a balance for each faction, Citizens NPCs may have balances, and there are other countless examples of "banks" or shared accounts that aren't directly tied to a user. Do we just randomly generate a UUID and hope it doesn't clash? Do we create an account with a String and prepend some sort of namespace? Or are UUIDs and String identifiers always assumed to be associated with a player?" This is where the methods with a String-based identifier come in, each plugin generally has their own prefix to denote that it's not a player(i.e. town_, nation_ for towny, faction- for factions). "On another note, I'm concerned that simply returning false when a method fails isn't clear enough. There are a multitude of different conditions you could consider a "failure" which, as a plugin calling the economy API, you might want to handle differently." Yes, this is something I've been concerned with too, and is something I started improving upon earlier this week, and will be included in this PR when it is ready. |
So do we assume that UUIDs should be associated with a player but Strings might not be? Out of interest, is there any public documentation on what the different failure responses will look like? |
|
Even with support of EssentialsX, I agree with @zml2008 that Reserve will struggle to gain the major adoption that Vault currently has due to the slow-moving nature of the Bukkit world. However, I have no objections to shipping Reserve support within EssentialsX once supported. Splitting it out into a separate plugin wouldn't make sense, as the economy register system used internally within EssentialsX is designed so that EssentialsX ships its own support for external economy APIs and there isn't much point shipping only one side of the implementation in this case. Can you confirm that EssentialsX and other plugins work together properly when using Reserve instead of Vault? Ideally they should work exactly as they would when using Vault. |
Yes, I understand this, but I want to start with getting economy providers to support it first then I can focus on non-provider developers adding support.
Yes I tested this before and it worked with Towny(since they have Reserve support). Obviously, I'll test it again with the updates that have been made to the implementation. |
mdcfe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly minor formatting issues and a quirk with the diff.
EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
Show resolved
Hide resolved
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
|
Corrected the strange diff showing up for some reason, probably from the merge of 2.x into my branch, and also the requested changes. I still want to verify that all works well still with additional testing later today after work. |
|
I've approved this pending testing. For reference, a test build of EssentialsX with Reserve support can be downloaded here. |
Ichbinjoe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly nits, this can go in without change.
Essentials/src/com/earth2me/essentials/register/payment/methods/ReserveEco.java
Show resolved
Hide resolved
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
Essentials/src/com/earth2me/essentials/services/ReserveEssentials.java
Outdated
Show resolved
Hide resolved
|
This has been tested and works correctly. The testing that was done: As a provider: |
|
Dead PR is dead. |
|
The reason this was not reviewed in January is that I could not find any public versions of Reserve and The New Economy that actually worked together; all the builds I could find threw errors whenever any plugin tried to access the economy through either Reserve or Vault. I'm not prepared to merge this PR when I can't guarantee that it works at all. I've been on a break for a while now and haven't been able to review major PRs for 2.18. Feel free to reopen this PR if you decide you want Reserve support added. |
Reserve is a new alternative to Vault, with modern functionality. Implemented the Economy API in this PR.
Main Advantages:
I mainly based this implementation off a quick glance of the Essentials Economy API, if there are any methods that seem like they are not implemented in the most efficient way just let me know.