Commit Graph

40 Commits

Author SHA1 Message Date
Phoenix616 24d89dbc44 Add ability to mark all economic events as handled
This resolves issues when multiple listeners try to handle the same
 events e.g. for group support which would've passed it onto the normal
 listeners leading to errors
2020-05-21 01:08:00 +01:00
Phoenix616 009febb5c2 Call add and subtract event to give listeners a chance to handle them 2020-05-13 23:56:47 +01:00
Phoenix616 0d08880ed2 Some cleanup of code and deprecated stuff
Also deprecate amount and account setters on the CurrencyCheckEvent,
these values will be final in a future version. Changing them here does
not make sense in the internal structure.
2020-05-03 02:37:06 +01:00
Phoenix616 e57bf94923 Don't continue checking if account can hold currency if already done 2020-04-24 14:54:48 +01:00
Phoenix616 d51a512ab8 Fix Vault CurrencyAmountEvent listener returning wrong balance 2019-09-06 13:31:19 +01:00
Phoenix616 04f91aa55b Add warnings about unknown OfflinePlayer to VaultListener
Also improve the ReserveListener by removing the query for the OfflinePlayer object as that's not necessary to use the Reserve economy API as it directly provides methods for UUID usage (and account existence has usually been checked before already)
Also use canAddHoldings to check if economy user can hold money instead of adding and removing.
2019-05-01 17:13:47 +01:00
Phoenix616 8cf9934a32 Properly set scale and rounding mode for divisions (Fixes #220) 2019-04-28 15:41:20 +01:00
Phoenix616 f0bc277566 Move to BigDecimal in all events and use the CurrencyTransferEvent
Also add tax bypass permissions (#204, ChestShop.notax.buy/sell). When buying with that permission the buyer does not have to pay the tax (the seller will still get the reduced amount), when selling the seller will get the full amount instead of one lowered by the tax.
The permissions of the shop owner play no role due to there not being a good way of checking offline player permissions and it being a bit non-obvious for the buying/selling player if a shop would be with or without tax. This way all that gets changed is the amount the player pays/receives and not the shop owner (and the player should know their permissions/rank already)

The transfer event was necessary in order to correctly resolve who triggered the transaction. Economy adapters are now required to implement a listener for each of the events. It's also recommended that economy adapters that support transfers directly use that instead of passing it through subtract and add with the processTransfer method.
2019-04-25 18:44:22 +01:00
Phoenix616 52492f8469 Support registering of economy providers after the plugin loaded 2019-04-06 16:24:20 +01:00
Phoenix616 03589b3fef Catch Vault issues with null usernames (#158, #194, #205, #209) 2019-03-30 16:09:48 +01:00
Phoenix616 355fa58ac4 Properly detect if reserve economy is provided (Fixes #210) 2019-03-18 15:10:18 +01:00
Phoenix616 fe85dafec5 Allow configuring what containers can be used for shops (Fixes #175) 2018-10-23 19:14:21 +01:00
Phoenix616 fc62ab0823 Use different economy responses and make some events cancellable
Also moved the creation fee subtraction to before the shop was created to be able to cancel the creation
2018-08-22 00:21:34 +01:00
Daniel V 8ae72e5803 Feature: Reserve Support (#143)
This introduces a new AccountCheckEvent to check if a user actually has an account with the used economy plugin. Also fix CurrencyTransferEvent logic (even though it's not used anywhere currently)
2018-07-11 18:09:07 +01:00
Phoenix616 036d309965 [CI-SKIP] Fix some formatting inconsistencies
Remove spaces on empty lines and changed doc comment formatting
Also includes some minor comments and import fixes
2018-05-07 15:32:51 +01:00
Phoenix616 29ef7f25aa Fix errors when server economy account is not defined or invalid 2017-11-15 21:13:07 +01:00
Phoenix616 2d45dcdac0 Get rid of expensive calls to Bukkit#getOfflinePlayer with a username
This changes events to store the database Account instead of an OfflinePlayer and deprecates any event method that uses/returns OfflinePlayer. This is necessary as Bukkit#getOfflinePlayer(String) queries Mojang for the UUID when the user was not found in the local cache. As we already store this information (name to UUID mapping) in our database we should not have no need to rely on querying Mojang. (This might make transactions fail for shop owners that haven't played before but that shouldn't really be an issue in most cases)
2017-10-29 23:50:24 +01:00
Phoenix616 b3b9e690dd Fix NPE when server economy account info can't be found (DevBukkit-1216)
Also add a warning to the startup if that happens
2017-07-09 17:00:31 +01:00
Phoenix616 0525c70452 Rewrite NameManager to support multiple short names per user
This should fix the issue where the player's short name on the shop sign does not reflect the actual player's name. This works by storing every uuid-username combination together with the associated short name and the last time the player logged in with that combination.
2017-07-01 17:14:41 +01:00
Dan Mulloy fa7a196bab Fix static access 2016-11-21 11:43:09 -05:00
L4BORG 24eb1b1e19 Economy fixes, fix for https://github.com/dmulloy2/ChestShop-3/issues/11 2016-10-13 18:11:23 +02:00
Dan Mulloy a13b2c9070 Fix a few NPE's caused by null accounts
Thanks @mibby
2016-07-07 12:15:43 -04:00
Andrzej Pomirski 28f9f08987 Fix money being transferred to the old username 2015-03-11 18:02:30 +01:00
Andrzej Pomirski f975450130 Fix an issue caused by Spigot/CraftBukkit "forgetting" the usernames
Somehow, OfflinePlayer initiated with an UUID does not contain the
"name" property after a while.
2015-01-17 15:18:32 +01:00
Andrzej Pomirski 31003ca29f Add rounding option to tax getter 2015-01-08 20:12:53 +01:00
Andrzej Pomirski 1bbf293379 Fix nicknames 2014-06-29 22:22:28 +02:00
Andrzej Pomirski 2a89fb345b NameManager > Bukkit 2014-06-22 14:33:02 +02:00
Andrzej Pomirski 9fa2f92ef8 Switch Vault from names to UUIDs 2014-06-14 20:46:59 +02:00
Andrzej Pomirski 404f7296e0 Remove Register - NO DEFAULT ECONOMY SUPPORT 2014-06-14 20:40:31 +02:00
Andrzej Pomirski 9ada7281cd Prevent taxes from being added to cancelled transactions as well 2014-02-10 12:27:52 +01:00
Acrobot 8a9f1c52c7 Protect from extremally high balances 2013-08-26 23:36:36 +02:00
Acrobot bfad819a0a Remove unnecessary imports 2013-08-10 19:53:42 +02:00
Acrobot aa87b01b68 Fix possible StackOverflowExceptions 2013-08-09 23:00:23 +02:00
Acrobot 438e3a6ed0 Fix an NPE when Vault was not found 2013-07-22 21:37:59 +02:00
Acrobot 968296f1bb Fix the issue with Admin Shops 2013-07-21 16:51:36 +02:00
Acrobot ff4cfb0c7c Automatic code re-format and re-organisation 2013-07-21 16:49:55 +02:00
Acrobot bca38b8a79 Transfer to new economy handling
No bank support... sorry @jrtc27, it's coming later!
2013-07-13 23:14:10 +02:00
Acrobot cb265136b0 Update pom.xml 2013-07-13 23:12:02 +02:00
Acrobot 2c0207adb1 Add economical listeners 2013-05-30 16:58:42 +02:00
Acrobot c86ffb623a Add an external Vault dependency 2013-05-30 16:57:54 +02:00