-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature] Multiple Currency Support #4
Comments
shouldnt this be a responsibility of another plugin? wouldnt this be BC breaking? |
Selector by the player or by the plugin using the API? |
Exchange rates are not a necessary part of a multi-currency system. |
Currency should be defined by the initiation code of a transaction. For example, in a pay operation, do we really want to allow any player to give any currency to anyone else, or do we only want it for a certain currency? What if the server opts to per-world currency, and the pay command should automatically select based on the world? Alternatively, for a shop command, should all currencies be allowed for trading? |
PT1: APIIMO it should ALWAYS be EXPLICITLY done by API, and it will be VERY nice, if it's ALWAYS EXPLICIT(so yes bc breaking) unlike economyapi which take the route of being BC compatible, by having some "default currency" if plugin didnt specify IMO it's bad, it encourage a lazy code, with undefined behaviour, most times plugins would not even have a config, and ONLY support default currency (yes very useful, multi currency but most plugins didnt even bother implementing that part) PT2: playerPlayers just shouldnt be able to "set which currency to use", that's up to the plugin using the API, Allowing player to "use this currency for that" would create more unnecessary complications or more complicated logic to control when conversion can be used, and when it cant I cant think of a good usecase that would justify this extra effort, i think the ability to support multiple currencies is good enough, and the rest should be up to the plugins |
Alternatively, a fuzzy model where multiple currencies are allowed and the best one or feasible ones are selected by the player is also doable. The caller defines a set of rules declaring which currencies are selectable and which currencies are not selectable, and gives each currency a score. Then the player is asked to select one of them, or the most likely one is selected based on machine learning algorithms. However, this is unlikely to be worth the cost in most cases, and is totally possible to do this selection in the API caller. |
Are we sure we want maximums at all? Is this a hard limit, or is this a soft limit that can be overridden explicitly? If it can be overridden, is it better to always ask the API caller (without default behaviour) whether the soft limit needs to be checked? |
One issue is how API callers can conveniently specify the currency to use. Should it be a string identifier like "dollar"/"elo"/"coin"/etc.? Or should it be an object reference? Most importantly, how should a trivial plugin supporting economy operations know what currency to use? In particular, if there does not exist a default currency, what should be the default value in the plugin config? |
actually from an adoption standpoint, not having a "default" currency can be problematic for plugin setup something more practical would be config: API design wise, it should be something like CurrencyObject->action(), rather then Plugin->action(currencyid) which is what economy api did, and what allow them to BC support all the way back into PO stone age for identifiers, there should be multiples: |
while i understand this post is made in humorous attempt, even so, this would be complicated, simply because different rates for each currency(if both currencies are the same rates, why would it be necessary to have 2 of these)
i agree in that, we had no minimum value, why do we need a maximum value? |
Actually both the amount of money and the currency should not have defaults. The value of one unit of any currency is not well-defined anyway, and plugins simply should not try to make a default. |
|
this looks overcomplicated. An identifier and a display format should suffice. The UUID has to be exposed through user interface (commands) anyway, so making an extra display name is pointless. |
Currency-oriented sounds like a bad idea. What is the advantage of this? |
https://forums.pmmp.io/threads/plugin-installation-wizards.885/ This RFC suggests a library to interactively query user for config values on startup. Perhaps developing a virion to do this would be helpful. Ideally, ParoxityEcon can provide an API to let user select currencies conveniently. |
fair enough, just thought of it off my head, what would be a better idea then? |
I don't see anything wrong with Nevertheless I still think atomicity is better. A single API to perform a transaction is better than asking developers to call two functions separately. |
Another issue: where are currencies defined? In #7 I raised the concern on configuration synchronization. Alternatively, we could synchronize the currency options with the database
I would not agree that it is a good idea to have a shared configuration defined in multiple config files. |
this reminds me, what happen if another plugin wanted to register a custom currency with a custom provider? |
@Thunder33345 can you define precisely "custom providers"? What is the point of introducing externally managed currencies into the system? |
say what happens if something i wanted isnt supported? |
@Thunder33345 what exactly do you want? I don't see the reason why you would want to store currency outside ParoxityEcon. If you need to do so, how does it even have anything to do with ParoxityEcon? |
probably more of "if it's possible why not" |
If there is no reasonable use of this feature, you are just increasing API complexity and making it harder to ensure backward compatibility. |
The current economy plugin provided by Onebone has multi-currency support. I would like to see an implementation added to this plugin also.
Add Exchange Rate APIThe text was updated successfully, but these errors were encountered: