Skip to content
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

Draft of API #3

Draft
wants to merge 12 commits into
base: dev
Choose a base branch
from
Draft

Draft of API #3

wants to merge 12 commits into from

Conversation

SirYwell
Copy link

@SirYwell SirYwell commented Oct 25, 2020

This is an experimental draft of an API similar to Sponge (see #2) mixed with the ideas I worked out before. There are a few additions, especially the Transaction stuff. It allows to handle money transfer between players/accounts atomically.

In the current state, there's not much documentation but if you agree with the overall design, I'll add that too.

TransactionContexts

I'm also not sure about the current usage of the TransactionContexts. From my understandings, that could be used to have e.g. world contexts, but if that's the case there is no way to transfer money from player A world X to player B world Y (?).

If you have any kind of feedback, please let me know (feel free to contact me on discord, SirYwell#0815).

Edit (2020-10-29)
A few other things I came up with in the last days:

Texts

When e.g. declining a transaction, people likely want to know why. It would help to have some kind of texts provided through the API. This might also apply for something like currency name.

To make this future-proof, we need to allow translatable strings (per player in best case), with support for different text formattings. On Sponge, we could simply use adventure for this, but I'm not sure if we want to force people to implement adventure in their economy plugin.

It also might help to make a TransactionCondition return something similar to the TransactionResult. This way, the message why a transaction was declined could be coming directly from that check.

Thread safety and asynchrounous transaction execution

Currently, any of transfer/withdraw/deposit directly returns the result. As some implementations might want to handle transactions on a separate thread, it might be better to return a Future instead.

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