This protects people that use valid player names as admin shop names
from people with the same username as well as other cases where the API
is used to manage access to shops with certain special names.
This adds a new config option ENSURE_CORRECT_PLAYERID which lets one
disable the check whether or not a player's UUID version matches the
server's online/offline mode UUID version. Due to potential issues with
offline players which might occur when this isn't checked disabling
this can't really be supported and any issues should first be tested if
they still occur with this option enabled.
This also forces the UUID to version 4 if the server runs in online mode
as it should not be necessary in any normal setup to detect the UUID
version dynamically in that case. (Dynamic detection is only necessary
for offline mode which might potentially run behind a proxy)
This has caused lots of confusion in the past regarding the first time
setup and might be a feature that people don't even want to have.
(e.g. to allow coloring of the signs with dyes)
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
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.
This adds some more logging to the metrics for some interesting plugin
settings as well as player account and transaction counts. This data
about account count and average transaction and item counts is also
exposed ingame via the /csmetrics command.
This also removes the outdated mcstats metrics as that site is long dead
now, the last data is from two years ago...
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
This adds a new OTHER_BREAK PreShopCreationEvent outcome to indicate
that the sign should get broken. To keep it backwards compatible with
other plugins setCancelled still sets OTHER and will not lead to a sign
break. The breaking logic is also moved out of the ErrorMessageSender
as it didn't make sense to have there. (It also wasted a tiny bit of CPU
by getting the block of the state again)
Do do this it now fully depend on LWCX, it's the only active version anways.
Also fixed a possible out of index error with the sign lines.
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.
This should be the final addition that allows other plugins to implement
multi-owner/group shops like requested in #119 and #133 by listening to
all the transaction events to handle money flow and shop/account access
events to enable access to the actual shop.
This adds better support for fake server economy accounts by not
requiring that a player with the name already has an account but allow
automatic creation of the account with the fake UUID provided in the
config.
Old configs that only define the name will still work though.
This makes it possible for other plugins to force allow placing of shops
and avoid potential issues in the check if multiple plugins are changing
the allow settings.
ALso while the allow counters were a nice idea they might not have even
worked correctly because in the case of only one plugin disallowing it
they would've still returned true at the end. Only if one listener
allowed it and another disallowed it the end result would be disallow.
This also makes the BuildPermissionEvent implement Cancellable (which is
an inverted allowed) in order to easily ignore events that are already
disallowed by another listener.
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.
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.
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.
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.
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.
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.