Commit Graph

429 Commits

Author SHA1 Message Date
Phoenix616
37b7669acb Fix players being allowed to build outside regions (Fixes #278)
Basically players were allowed to build shops outside regions in the
case where no region manager was available.
2020-01-15 23:13:18 +01:00
Phoenix616
4067427650 Add ability to define type of LWC protection in config 2020-01-15 22:55:40 +01:00
Phoenix616
2075693e12 Add ability to send shop owner notifications via BungeeCord 2019-11-19 21:50:17 +01:00
Phoenix616
40467e3522 Add support for Paper's BlockDestroyEvent for sign breaks (Fixes #214)
Instead of using different modules we use a bukkit profile to test backwards compatibility with pure-Bukkit servers and use the paper-api in the default profile. This should really be done with modules in the future. The actual selection which listener to use is handled by checking if the event class exists on event registration.
2019-11-04 17:26:43 +01:00
Phoenix616
35dd13f917 Slightly change access_denied message to indicate container access error
This is necessary as the no_permission error was worded exactly the same making debugging more difficulty. Also this way someone who thinks he needs to access the chest doesn't think that he doesn't have access to the shop at all.
2019-11-04 17:26:22 +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
c028015d5e Improve /cstoggle by using UUIDs and HashSet instead of ArrayList 2019-09-14 23:49:40 +01:00
Phoenix616
d51a512ab8 Fix Vault CurrencyAmountEvent listener returning wrong balance 2019-09-06 13:31:19 +01:00
Phoenix616
bc680afcaf Slightly rework item comparison to fix legacy spawn eggs (Fixes #264) 2019-09-06 13:23:49 +01:00
Phoenix616
58cf96dca8 Fix issues with double chests not begin detected as shops in some cases 2019-08-31 11:20:02 +01:00
Phoenix616
b718fcc429 Use shop owner for LWC protections and not the creator
Also fix a bug where it was possible for shops to be created with shop owners that did not have a valid Account information when other plugins manipulated the name line after the NameChecker checked it. Now it gets checked twice, once at the start (to abort early and to populate the ownerAccount field) and once at the end to check again when the name line changed.
2019-08-22 14:03:27 +01:00
Phoenix616
f90d23cfc3 Update LWC protection and support more LWC forks (LWCX and Modern-LWC) 2019-08-22 13:09:54 +01:00
Phoenix616
5eb467a1d3 Set UUID version if players are online when manager loads (Fixes #265) 2019-08-20 13:15:41 +01:00
Phoenix616
930b2cc07b Use prepared queries to avoid special character issues (Fixes #258) 2019-07-29 18:50:26 +01:00
Phoenix616
e972a7d657 Add further workarounds for comparing meta data (Fixes #250)
This is especially obvious for books where all the text will have color codes after dumping and loading them from the database. In order to be able to still compare to them we will load the item the item and then dump it again if it doesn't match the original one.
2019-07-08 18:05:50 +01:00
Phoenix616
6c5e5ece81 Block editing of shop signs that user can't destroy (BUKKIT-1293) 2019-07-08 17:21:21 +01:00
Phoenix616
481e2bdf9e Fix issue with sign sticker 2019-06-09 15:04:14 +01:00
Phoenix616
b0523b2199 Add cooldown for empty/full shop owner notifications 2019-05-27 17:11:09 +01:00
Phoenix616
26daa4531d Always register WorldGuard shop flag (Fixes #230)
The configuration isn't loaded yet when the plugin loaded and the flag initialised so we can't check that there. The config option is checked at the point where the flag is handled though so there is no difference from the intended functionality when registering the flag anyways. The only downside is that this could be a tiny bit confusing to the user in the end but I think that is a small price to pay when it wouldn't be working at all otherwise.
2019-05-13 00:16:57 +01:00
Phoenix616
17e7ab781b Fix shops creation message getting send on auto fill
The NameChecker now catches any exception that might be thrown when querying the account in order to properly cancel in the case of an unknown account or an error that occurred in the event to not let players create shops that they don't have access to if an exception occurs.
2019-05-08 00:22:16 +01:00
Phoenix616
2907706399 Actually send error message and break sign on unknown player error 2019-05-08 00:11:47 +01:00
Phoenix616
a8c57bc0ab Set name line empty if name isn't usable and always use account name 2019-05-07 23:57:56 +01:00
Phoenix616
ca94031ddf Fix wrong UUID version comparison logic 2019-05-07 23:48:04 +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
619ac17cd5 Also use registry to get the allow-shop flag 2019-05-06 18:19:33 +01:00
Phoenix616
2e0c5a3cac Fix issues with user account storage on shop creation
This fixes a bug where shop owner accounts would not be created in certain cases e.g. when the owner had certain admin permissions or created the account for another player while having certain admin permissions.
2019-05-05 19:23:04 +01:00
Phoenix616
4769ae2cf7 Allow loading of different numbers to BigDecimal (Fixes #225)
Also catch wrong types when loading the config better without completely disabling the plugin and revert "Make sure special parsers are setup" and register the parsers static again.
2019-05-03 21:08:56 +01:00
Phoenix616
da1dd94705 Make sure special parsers are setup (Might prevent #225)
There might have been a case where when trying to pair the yml file with the Properties class the parsers weren't actually registered yet as nothing was called on the Properties file yet.
2019-05-02 18:35:45 +01:00
Phoenix616
816fe77f27 Use registry to register WorldGuard flags 2019-05-01 17:21:46 +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
0b57382cd0 Don't use sign Material as that's going to change in 1.14 2019-05-01 17:01:43 +01:00
Phoenix616
c538f4a3dc Remove all usage of old MaterialData and other outdated code
This should make it more future-proof and possibly even work with 1.14 already.
2019-04-30 21:31:24 +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
6e78fea880 Update the container on item transfers (Fixes #217)
This was removed when the item transfer code changed which stopped comparators from working. This shouldn't be a true block update that observers can detect but only a notification for surrounding blocks that the content might have changed.
2019-04-23 18:00:21 +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
53ae07b779 Fix error that prevented selling to admin shops 2019-04-07 13:47:18 +01:00
Phoenix616
8a09e91e62 Better catch for potential exceptions when de-serializing items
For some reason items might corrupt in the encoding and decoding process leading to invalid YAML strings. There's also another issue of the server not being able to load certain old itemstacks. (seems to be especially an issue with old entity types)
2019-04-06 18:39:49 +01:00
Phoenix616
52492f8469 Support registering of economy providers after the plugin loaded 2019-04-06 16:24:20 +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
1952e5cb46 Directly transfer items (Fixes #169) 2019-04-05 14:49:27 +01:00
Phoenix616
2007c4a7fb Fix ShopDestroyEvent not getting called in certain cases
This could be triggered by updating a column of physics blocks with a shop attached
2019-04-01 13:55:21 +01:00
Phoenix616
be5f47cb1f Add config option to toggle if all shop removals should be logged
Removals that happened due to no player being present will always be logged
2019-04-01 13:49:48 +01:00
Phoenix616
03589b3fef Catch Vault issues with null usernames (#158, #194, #205, #209) 2019-03-30 16:09:48 +01:00
Phoenix616
b37bf12e7f Convert old item metadata to newest version (Fixes #202) 2019-03-30 15:40:31 +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
355fa58ac4 Properly detect if reserve economy is provided (Fixes #210) 2019-03-18 15:10:18 +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
6d99210dd7 Really fix price restriction 2019-01-19 00:40:50 +01:00
Phoenix616
20228dd645 Fix amount in price restriction not working correctly
Also fix copy and paste error in SELL_PRICE_BELOW_MIN error message.
2019-01-18 22:27:40 +01:00
Phoenix616
91a372bd05 Make Item and Material parsing events 2019-01-17 19:50:47 +01:00
Phoenix616
c8d0590614 Add different error messages when price limits are exceeded (#193) 2019-01-17 18:08:54 +01:00
Phoenix616
6fe6f80538 Use Bukkit's inbuilt command permissions system (Fixes #186)
Also fix plugin not disabling when dependencies aren't loaded correctly
2018-11-25 00:59:13 +01:00
Phoenix616
bc14736a37 Ignore cancelled sign change events 2018-11-21 00:45:39 +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
b17a471c21 Check if dependency is enabled (Fixes #181) 2018-11-12 15:03:13 +01:00
Phoenix616
727f49fc28 Update to new Vector API in WorldEdit/WorldGuard 7 2018-11-06 15:35:28 +01:00
Phoenix616
7adf02e532 Improve hopper protection
The InventoryMoveItemEvent is now only used for Hopper Minecarts, other blocks that could move items (Hoppers and Droppers) are checked on place. That way players that have access to a shop can just use the blocks normally but other players can't place them.
2018-10-23 19:27:39 +01:00
Phoenix616
fe85dafec5 Allow configuring what containers can be used for shops (Fixes #175) 2018-10-23 19:14:21 +01:00
Phoenix616
b5f77d67b5 Fix color of ShowItem insert bleeding into message 2018-10-23 19:02:09 +01:00
Phoenix616
470f9d8d99 Allow admins to create shops for other users (Fixes #176) 2018-10-23 16:06:27 +01:00
Phoenix616
2243c2fbc6 Update to new AuthMeReloaded API (Fixes #174) 2018-10-15 20:27:38 +01:00
Phoenix616
26d800132c Merge branch '1.12' into 1.13 2018-09-26 17:02: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
39a522716f Merge branch '1.12' into 1.13 2018-09-18 00:09:07 +01:00
Phoenix616
96b5a675d6 Allow admins to use the admin shop in all cases
This fixes issues with the auto complete right click functionality not working with admin shops
2018-09-18 00:08:54 +01:00
Phoenix616
0c6aaaa6f7 Fix damage not getting set properly 2018-09-10 01:11:42 +01:00
Phoenix616
adf5340932 Remove spaces from shortened strings for better readability
This is necessary due to the extended length of some material names in 1.13 as they directly include the variation into the material where previously only the data value was used. (E.g. BLACK_STAINED_GLASS_PANE) By removing the spaces and using uppercase characters to separate parts the string stays both readable to the user and parseable by the plugin. It should also be backwards compatible with the old format. (At least with 1.13 material names)
2018-09-10 00:33:27 +01:00
Phoenix616
e1998bcd7c Merge branch '1.12' into 1.13
# Conflicts:
#	src/main/java/com/Acrobot/Breeze/Utils/MaterialUtil.java
2018-09-10 00:31:26 +01:00
Phoenix616
12d2107ce1 Fix passing Material enum strings directly to getShortenedName 2018-09-10 00:25:25 +01:00
Phoenix616
173991ab4a Use spaces and proper casing for calculating width (Fixes #166)
This also slightly changes which name part gets shortened first. It will first shorten the longest name and then the rest.
2018-09-09 22:43:49 +01:00
Phoenix616
54b3b6966c Merge branch '1.12' into 1.13
# Conflicts:
#	src/main/java/com/Acrobot/Breeze/Utils/MaterialUtil.java
#	src/test/java/com/Acrobot/Breeze/Tests/MaterialTest.java
2018-09-09 14:47:32 +01:00
Phoenix616
516eefc5b6 Allow longer item names on signs by calculating the width
This uses hardcoded widths for the main characters used in Minecraft and might not be precise for some characters but better than the previous 15 char hard limit.
2018-09-09 14:37:09 +01:00
Phoenix616
2459a406fe Auto-correct item code on sign.
This also makes it possible to input IDs on the sign that are longer than the max sign letters that the plugin uses as that just gets auto corrected back down to the correct amount.
2018-09-09 13:26:08 +01:00
Phoenix616
afab90d021 Fix wording in of incorrect item id message 2018-09-09 13:24:26 +01:00
Phoenix616
f1ce97dbce Merge branch '1.12' into 1.13 2018-09-05 23:07:49 +01:00
Phoenix616
df76347697 Improve sign price corrections
This includes a new price_precision config entry to set the amount of decimal places to allow on a shop sign (set to 2 by default). Thanks to @andrewkm for this idea.
It also fixes an issue where a zero inside the decimal places was removed instead of it's end and also removes the point and zeros from prices that only have trailing zeros to avoid confusion (e.g. in languages that use the decimal point for thousands)
2018-09-05 23:07:35 +01:00
Phoenix616
01ebedcc84 Merge branch '1.12' into 1.13 2018-08-31 13:55:54 +01:00
Phoenix616
06e4e1bf17 Don't search offline players when checking for existing (Fixes #162) 2018-08-31 13:55:36 +01:00
Phoenix616
5f0bbfff0c Merge branch '1.12' into 1.13 2018-08-29 21:29:52 +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
Phoenix616
640364e7e7 Actually return the block that the sign is attached to 2018-08-29 21:02:06 +01:00
Brokkonaut
f5b3aa6b75 1.13 allows single chests besides each other. Handle that correctly. 2018-08-29 20:57:48 +01:00
Brokkonaut
b972e79132 Update to WorldGuard 7.0.0 (for 1.13) 2018-08-29 20:32:27 +01:00
Phoenix616
cf9e5bafde Merge branch '1.12' into 1.13 2018-08-23 22:12:58 +01:00
Phoenix616
836ef56864 Add more message placeholders (Fixes #159) 2018-08-23 22:10:24 +01:00
Phoenix616
e155b98c96 Merge branch '1.12' into 1.13 2018-08-22 00:29:12 +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
Phoenix616
89dcde83de Differentiate between wall and standing signs (Fixes #147) 2018-07-29 15:05:45 +01:00
Phoenix616
d4e39a3751 Make it compile with 1.13. No guarantees that it works without issues! 2018-07-26 00:13:06 +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
7311907559 Add more per material shop creation permissions 2018-06-24 00:17:35 +01:00
Phoenix616
1cb481097c Don't refund for non-finished signs (Fixes #141) 2018-06-23 15:01:41 +01:00
Phoenix616
247b2d239e Fix issues with alternative block materials forms
This also removes the number in the name from /iteminfo and the autocompletion
2018-06-18 20:04:17 +01:00
Phoenix616
5b925171e3 Add support for stored enchantments to /iteminfo and format it better
Partly fixes #135
2018-06-03 19:23:40 +01:00
Phoenix616
c39720b449 Don't try to get the MaterialData from every damage (Fixes #131)
We will have to add a new way of handling that for 1.13 anyways when data isn't using damage values anymore.
2018-05-15 23:58:34 +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