KaiKikuchi / QuickShop

A shop plugin for Bukkit
47 stars 41 forks source link

Always showing cents on signs #115

Closed smmmadden closed 7 years ago

smmmadden commented 7 years ago

I couldn't find anything in the config.yml or the messages.yml for the decimal support. The sign below shows incorrectly for US currency. image The first sign should be .50 each (cents) and the second sign should read 1.00 each (dollars). Seems only a single digit precision for currency is used. The config has the option for "whole-number-prices-only: false" but not on the sign unfortunately.

KaiKikuchi commented 7 years ago

The "whole-number-prices-only" config setting defines whether decimal prices are allowed or not.

Also I think everyone know that 0.5 and 0.50 are the same exact amount. Both are 50 cents. And that is how Java double values are usually represented.

This could be considered an aesthetical issue more than anything else.

smmmadden commented 7 years ago

you're assuming the only players are adults and they know the difference. I also have children under 18 on my servers. :-) When the currency prefix is not shown (e.g. $) or the currency name (cent, cents, dollar or dollars), some will not understand this is the cost, versus how many you want. Keep in mind that this is a new plugin for all my servers and users will be confused at first. :-) My other plugins properly have a 2 placed decimal for currencies. image

KaiKikuchi commented 7 years ago

QuickShop shows the correct amount everywhere but on signs because signs have limited line length so the normal format cannot be used.

Also please remember that I am not the original developer of this plugin so I inherited that.

smmmadden commented 7 years ago

I understand Kai and I'm happy to donate to you to help enhance the plugin. The 4th line could also just say 1.00 each to help make sure it fits. "For" is implied and not necessary.

KaiKikuchi commented 7 years ago

I am also not a native English speaker so I was unaware whether "For" was necessary or not.

Also, thank you.

smmmadden commented 7 years ago

not a problem, just helping :)

smmmadden commented 7 years ago

One way to achieve this is to use the locale of the server owner. Many plugin developers include a locale folder with multiple "messages_**.yml files. This is also very common in the software industry which I am in and our customers require it since we are talking real money. :-)

Where the ** in the name would be the language "es", "fr" giving the user complete autonomy in their messages and default behavior. You do this already with "messages.yml", but having one for each of the languages (en, lt, fr, es, de, cz, cs, ru and tr, zhcn to name only a few) adds a lot of flexibility to the plugin. Of course, you don't have to do the translations, you can ask your customers to translate and share with you. As you get them in, update the plugin build with it, and done! Many of the plugin owners I work with, do the same, so it is a common practice.

The thought I had is that the messages_en.yml in my case (USA), Two variables to support this:

  1. use_decimals: true or false
  2. no_of_decimals: 0-6 If (1) = false, set no_of_decimals=0 If (1) = true, pad no_of_decimals with 0 Examples: no_of_decimals: 1 price-per and total-value-of-chest would be 1.0, 10.0, 100.0, 1000.0 where we only zero fill to the right of the decimal point. no_of_decimals: 2 price-per and total-value-of-chest would be 1.00, 10.00, 100.00, 1000.00 no_of_decimals: 3 price-per and total-value-of-chest would be 1.000, 10.000, 100.000, 1000.000 and so on. This would make it consistent with the users currency location.

The last part of this enhancement would be to include a new variable for "currency". Where the messages_**.yml would have the list of http://www.xe.com/symbols.php and you can choose whether or not to have users provide the Currency Code and the plugin supply the graphic character. Currencies do not change so this is a one-time enhancement that everyone gets. This would show as $100.00 for one hundred dollars. Then the currency type (dollar, dollars, cent, cents, etc) is optional. You only need to show the currency symbol or the currency type.

Hope this helps! Do let me know if this is something you'll be able to include, I'm happy to test it out as well and as I stated, donate to you to make it worthwhile. :-) I don't know the current state of the plugin whether you want to enhance it or not. I suspect that 1.12 (pre released today) will cause plugins to break again.

KaiKikuchi commented 7 years ago

Although I know what you're talking about, I do not really see the point of it for this plugin. The issue is just for signs, and I can always make it show the formatted price as defined on the economy plugin. Similarly to the formatted price on the details message shown when you click a shop.

smmmadden commented 7 years ago

you are thinking like a developer and not a player. :-) Nothing wrong with that, but the point is to make it visually correct regardless of the locale the user is in. If you feel that enhancing this plugin isn't worth any time or effort, do let me know so I don't spend more time on it than it may be worth. I'm trying to stick with plugins where the developer is "actively" engaged and making enhancements and bug fixes being reported.

KaiKikuchi commented 7 years ago

You are misunderstanding. The issue has been fixed, but not the way you're suggesting. The economy plugin already provides a way to format prices based on the economy plugin's settings. Why would the server owners want to set this twice? Anyway, please just wait the next version.

smmmadden commented 7 years ago

my apologies, I was misunderstanding that it is being fixed in the next version. I'll check it out on the next update. Thanks!

KaiKikuchi commented 7 years ago

Done in v.0.9.30