Commit Graph

86 Commits

Author SHA1 Message Date
Phoenix616
7203ec17cd
Add compatibility for new sign-editing in 1.20
This allows editing of signs if you hold a sign in hand but block any other interaction.
2023-06-13 00:11:48 +01:00
Phoenix616
d52c329618
Make compatible with Folia by using own ExecutorService
Our async tasks were already pretty world-independent (update checker as
 well as some logging so this should work pretty well)

For the rest the ORMLite library should already be able to handle access from
 different threads and whether economy plugins are compatible with Folia is
 up to them, not us...
2023-03-23 23:50:43 +01:00
Phoenix616
02ef09c586
Use non-deprecated setScale, remove duplicate division calls, NPE-Fix 2023-03-01 18:10:25 +01:00
Phoenix616
aa7bfbb7ee
DoubleChest left/right side holder might be null/not BlockStates. Check that. 2023-03-01 18:06:35 +01:00
Phoenix616
99a609b423
Unify sign line parsing and strip owner line whitespace 2022-01-26 20:35:42 +01:00
TreyRuffy
bb7bd3415c
ChestShop Sign Dying (#479)
Signed-off-by: TreyRuffy <TreyRuffy@users.noreply.github.com>
2021-10-12 23:30:49 +01:00
Phoenix616
2be9207faa
Differentiate between shop accessing and administrating
This fixes LWC donation and display protections not working correctly
2021-05-16 00:31:33 +01:00
Phoenix616
c9b8e136d1
Fix that shop info doesn't show when protected externally 2021-05-16 00:06:01 +01:00
Phoenix616
4172d8d484
Cancel sign change and interact if previous events are cancelled
This fixes that blocks get placed/items used when trying to auto-fill
 a shop sign and the sign is getting destroyed for some reason
2021-04-16 21:03:37 +01:00
Phoenix616
ebdebb81df
Implement /shopinfo command/chest click for shop info (Resolves #203)
The shop information can include the owner, available stock, the buy/
 sell prices and detailed item information from the ItemInfoEvent.
This also includes an item component in both /iteminfo and /shopinfo if
 ShowItem is installed.
2021-02-15 17:28:33 +01:00
Phoenix616
65df4c40c6
Improve performance by using Paper's non-snapshot states if available 2021-01-28 17:18:42 +01:00
Phoenix616
ba47b82ba1
Make Admin Shops use containers if available (Resolves #402)
Admin Shops can now be stocked the same way as player shops if a valid
 shop container is nearby. If no container is nearby it will just work
 as an unlimited shop.

This behaviour can be disabled with the FORCE_UNLIMITED_ADMIN_SHOP
 config option so that an admin shop is unlimited even though a valid
 container is next to it.
2021-01-24 23:33:36 +01:00
Phoenix616
b774258051
Remove OddItem support and implement own alias system (Resolves #360)
Reasoning why this is part of the core and not a separate addon:
The impact of this function is extremely lightweight when (almost) no
 aliases are defined so someone who isn't using this should not have a
 worse experience.
Additionally including it in the core (similarly to the discounts,
 taxes and restrictions) promotes it's availability while not massively
 increasing the maintainability.

As for the OddItem removal:
That plugin hasn't been developed for over 7 years and such unique
 plugin support should really be added via separate addon using the
 events system which, with the new ItemStringQueryEvent, now actually
 supports doing that from an external plugin.
If someone really managed to run their own private fork of OddItem for
 all those years then they should be able to also provide such a simple
 addon.
2021-01-03 01:55:01 +01:00
Phoenix616
f0bf9a08ec
Add message to access and creative mode ignoring 2020-10-31 20:59:07 +01:00
Brice Frisco
8d98958c2d
Stock Counter (Resolves #365) (#368) 2020-10-30 22:45:16 +01:00
Phoenix616
a14aaa7235
Fix issues with LWC Single/Double Chest protections (Fixes #359) 2020-09-24 16:54:36 +01:00
Corey Shupe
282c39c975
Implement LockettePro support and improve soft dependency handling (#354) 2020-09-10 14:32:34 +01:00
Phoenix616
6a34054bc7
Add latest test profile 2020-07-08 21:38:54 +01:00
Phoenix616
efe9ff7024
Fix TURN_OFF_SIGN_PROTECTION not working (Fixes #233) 2020-07-03 18:56:29 +01:00
Phoenix616
9cbf33f68f
Cancel before sending message so that access is denied in case of error 2020-07-03 17:26:13 +01:00
Phoenix616
6ee7c4759a
Add multi-language and component message support (Requires Spigot)
Message configs are now selected based on the client's language (can be
 toggled in the config) and will use MineDown formatting to allow
 display of component messages as well as usage of RGB colors in 1.16.
If found the legacy local.yml will be used instead of the per-language
 files. Move your local.yml to the correct lang config to if you want to
 use the per-client language option.
Version was also changed to 3.11 due to the many internal changes that
 have accumulated over time
2020-06-28 18:00:09 +01:00
Phoenix616
cbd427f561 Cancel left click event on shop sign
This should improve compatibility with other plugins that handle left
 click interactions too and shouldn't apply to shop signs you don't have
 access to.
Also includes a small improvement to not run the same permission check
 twice in certain cases.
2020-06-24 16:00:16 +01:00
Phoenix616
1f8fd09dd2 Only update player name on join, don't create new accounts 2020-06-19 20:57:22 +01:00
Phoenix616
3e061dda8d Add config option to limit trading with shops via protections 2020-06-18 17:01:52 +01:00
Phoenix616
9f84ca8551 Add option to sell/buy all with shift (#320) 2020-05-31 14:50:53 +01:00
Phoenix616
e22a50e1cf Only close our own inventories on teleport (Fixes #312) 2020-05-16 22:33:52 +01:00
Phoenix616
7f32a7a722 Fix InventoryOpenEvent listener not applying to non chest containers 2020-05-16 22:30:14 +01:00
Phoenix616
bb17cc35a0 Add ability to set max amount and improve error messages 2020-03-24 00:31:08 +01:00
g--o
88a23a38db Added toggle access command (#271)
Thanks to @g--o and @JRoy
2019-09-16 12:56:30 +01:00
Phoenix616
a95f7316d6 Fix ProtectionCheckEvent not being used when accessing shop 2019-05-07 16:13:56 +01:00
Phoenix616
b300798a62 Make querying of accounts by (short) name an event too 2019-05-06 23:49:16 +01:00
Phoenix616
6773f89221 Improve internal precision of calculations (Fixes #221) 2019-04-30 16:02:01 +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
28fb5cbeff Fix message amount display error when buying from admin shops
Also fix that the stock items were modified when buying from the admin shop
2019-04-07 13:48:16 +01:00
Phoenix616
5a99180aab Fix Admin Shops by adding more implementation to AdminInventory
This is required as we now move items between inventories instead of individually removing and adding. This basically adds the stock represented by the admin shop sign to the AdminInventory so all transactions should always be possible.
2019-04-05 15:17:15 +01:00
Phoenix616
8cd89bf8ee Work around issue with serialising explorer maps
This is due to a bug in CraftBukkit not properly supporting localised/translatable display names when serialising item meta.
This also adds/improves the message when no valid item ID could be generated.
2019-03-19 19:08:53 +01:00
Phoenix616
b931393a62 Fix more issues with the shop access permissions (#207) 2019-03-08 22:52:08 +01:00
Phoenix616
de5b505ec5 Fix issues with shop sign opening and access permissions (Fixes #207) 2019-03-07 17:33:47 +01:00
Phoenix616
91a372bd05 Make Item and Material parsing events 2019-01-17 19:50:47 +01:00
Phoenix616
b853afbd52 Fix issues with the permissions for using different player names
This adds separate permissions for accessing, creating and destroying of shops.
It also adds a config entry to allow using of a shop even if someone have access to it due to their permissions.
2018-11-19 21:10:48 +01:00
Phoenix616
fe85dafec5 Allow configuring what containers can be used for shops (Fixes #175) 2018-10-23 19:14:21 +01:00
Phoenix616
b30688b635 Fix issues with admin shops, ops and creative mode (Fixes #168) 2018-09-26 17:02:13 +01:00
Phoenix616
dd4177e7cb Query server's player cache for missing players
This uses a cache for players that we haven't found before so to not check the cache too often and also checks if the online mode of the queried OfflinePlayer matches the server's mode (gotten from the first logged-in player in order to be compatible with BungeeCord requiring the server to be in offline-mode.
2018-08-29 21:29:27 +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
ae8d1c79e9 Properly check if item is empty (Fixes #123) 2018-04-02 17:41:45 +01:00
Tim222
21815197c6 Fix Vault-Accountcheck for renamed player (#106) 2018-01-27 17:12:34 +01:00
Phoenix616
b2a31b8eb2 Add ability to autofill sign by clicking it
Also disable the worldguard shop flag by default...
2018-01-07 02:11:59 +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