Commit Graph

1310 Commits (d5a7c304b912ee273586b095751e64360cb87cff)

Author SHA1 Message Date
blablubbabc d5a7c304b9 The config key pattern is cached now. 2020-11-25 02:25:12 +01:00
blablubbabc a2bcd14aaa Changes to the maximum shops limit.
* A value of '0' for the 'max-shops-per-player' setting no longer indicates no limit, but can be used to disable the creation and hiring of player shops. 'No limit' is indicated by a value of '-1' now. Any previous limit of '0' is automatically migrated.
* The permissions specified inside the config get cached and checked in decreasing order now. We abort checking permissions if they cannot further increase the player's current shops limit. An effect of this is that it is only possible to increase the default limit, not decrease it.
* Added permission node 'shopkeeper.maxshops.unlimited' (default: op), which disables the max shops limit for a player.
* Message: Changed the 'too-many-shops' message to be more general.
2020-11-25 02:22:05 +01:00
blablubbabc 17e910ad3a Color codes for default non-Text messages get replaced as well now. 2020-11-24 18:43:14 +01:00
blablubbabc a335245328 Moved 'editor-title' and 'for-hire-title' from config into messages. 2020-11-24 18:32:00 +01:00
blablubbabc 937961d2e9 Changed the default color of 'villager-editor-title' to be less bright. 2020-11-24 18:23:57 +01:00
blablubbabc de274ae203 Added test cases to validate the default config and language files. 2020-11-23 15:01:13 +01:00
blablubbabc a325aaabe1 Consistent ordering of settings with default config. 2020-11-23 14:57:40 +01:00
blablubbabc adeeaea613 Updated the default german translation to the recent changes. 2020-11-23 14:56:57 +01:00
blablubbabc 0dfc51a6b1 Improved the feedback messages when a player tries to create a shop via
command.

* If the player targets a container (regardless of whether it is
supported), we assume that he might be trying to create a player shop.
However, unlike before this only affects the default shop type that is
chosen if the player does not specify a shop type himself.
* It is now possible to create admin shops via command even when
targeting a container. However, the admin shop type has to be explicitly
specified as command argument.
* When a player shop type is selected, we send appropriate feedback
messages depending on whether player shop creation via command is
enabled, whether a container is targeted, and whether it is a supported
type of container.
* When not specifying a shop object type, we pick the first shop object
type that can be used by the player. This is consistent between the
creation of player and admin shops now.

Messages:
* Added 'must-target-container'.
* Added 'no-player-shops-via-command'.
* Removed 'no-admin-shop-type-selected'.
* Removed 'no-player-shop-type-selected'.
2020-11-23 14:19:17 +01:00
blablubbabc ccc76cf363 Changed: Players in creative mode are no longer ignored when using the
shop creation item.

This seems to cause more confusion than it helps. Also, this is less of
an issue, because the default shop creation item is a villager egg with
specific display name since some time now.
2020-11-23 12:08:02 +01:00
blablubbabc b12616ecfc Changed all message keys from 'cant' to 'cannot'.
* 'cant-hire' -> 'cannot-hire'
* 'cant-hire-shop-type' -> 'cannot-hire-shop-type'
* 'cant-trade-with-own-shop' -> 'cannot-trade-with-own-shop'
* 'cant-trade-while-owner-online' -> 'cannot-trade-while-owner-online'
* 'cant-trade-with-shop-missing-container' ->
'cannot-trade-with-shop-missing-container'
2020-11-21 19:00:43 +01:00
blablubbabc 201a77d78a Moved language setting to the top of the default config. 2020-11-21 18:56:06 +01:00
blablubbabc 4080de2387 Separated messages from the config.
* We always generate an 'en-default' language file. This file acts as a
template for custom language files. It is not meant to be modified and
is replaced with an up-to-date version on every plugin startup.
* Config: Changed the default language from 'en' to 'en-default'.
Existing configs get automatically migrated.
* Fixed: Text#parse can now also parse alternative color codes starting
with '&'. This has an effect when some messages of the specified
language file cannot be loaded and the plugin then uses the default
messages instead. This is part of Text#parse now (instead of requiring a
separate color conversion) for convenience reasons.
* Added warning output when the language file misses messages, or
contains unexpected messages.
* All message keys were changed to no longer start with the 'msg'
prefix.
2020-11-21 18:51:18 +01:00
blablubbabc a92a6e7d7d Data and language files are stored in separate folders now.
The old save file is automatically moved. Existing language files need
to be moved manually. Existing trading logs are not moved.
2020-11-14 01:20:36 +01:00
blablubbabc d6aef5193d Prepared next version. 2020-11-03 22:38:41 +01:00
blablubbabc a72b1bf657 Version 2.12.0
Updated for MC 1.16.4.
2020-11-03 22:37:52 +01:00
blablubbabc b776ac4163 Fixed: The Towny integration could run into a NPE when checking if a
location is within a commercial area.

We are also using the latest API now, since the old Towny API has been
deprecated.
2020-10-28 11:30:45 +01:00
blablubbabc 7b7f1e3bfb Players without the permission to edit regular villagers will silently
access the regular trading interface now when they sneak and right-click
a regular villager.
2020-10-28 01:17:24 +01:00
blablubbabc 47264cab00 UI requests can be silent now. 2020-10-28 00:42:35 +01:00
blablubbabc 58e1e9476b UIHandler#canOpen is public now. 2020-10-28 00:28:08 +01:00
blablubbabc 3a39d9bc9b Fixed: Some messages would print an empty line when set to an empty
text, instead of being disabled.
2020-10-28 00:15:23 +01:00
blablubbabc 43f1ca57de Editor UIs are setup lazily now, only when required for the first time. 2020-10-24 22:05:55 +02:00
blablubbabc 6166e834ee UIHandler#canOpen has an additional 'silent' flag now. 2020-10-24 21:52:27 +02:00
blablubbabc d05e051348 Updated readme. 2020-09-01 00:44:00 +02:00
blablubbabc 69d3863859 Added note about Jitpack. 2020-09-01 00:43:04 +02:00
blablubbabc 69950e417a Updated readme. 2020-09-01 00:23:07 +02:00
blablubbabc b30c29e17f Updated building instructions. 2020-09-01 00:11:35 +02:00
blablubbabc 51ad2f700b Updated changelog and update-checklist. 2020-08-31 23:55:48 +02:00
blablubbabc 783197b8f2 Made scripts executable. 2020-08-31 23:38:14 +02:00
blablubbabc 181ca6dbd2 Added installSpigotDependencies script. 2020-08-31 23:37:08 +02:00
blablubbabc f12af66246 Bumped Towny dependency and use Jitpack repository. 2020-08-31 19:28:23 +02:00
blablubbabc dc7c18e7ca Added maven wrapper and jitpack config. 2020-08-31 19:04:42 +02:00
blablubbabc d39f153a92 Minor change fix for consistency reasons. 2020-08-21 18:29:57 +02:00
blablubbabc 1925238d96 Updated changelog. 2020-08-21 18:19:35 +02:00
blablubbabc 6d369eda1d Added some more examples for the name-regex setting. 2020-08-21 18:16:42 +02:00
blablubbabc b0f13acf12 Minor changelog fix. 2020-08-13 06:42:16 +02:00
blablubbabc 2b9214e042 Fixed: Creating shopkeepers via Citizens trait failed previously if the block at the spawn location is not passable.
This is for example the case when the Citizens NPC stands on a non-full block such as carpet.
2020-08-13 04:42:03 +02:00
blablubbabc 30dd2a4557 Minor changes to handling failures when trying to create a shopkeeper via Citizens trait.
We always inform the player (if there is one), log a warning and delete the trait again now.
2020-08-13 04:32:02 +02:00
blablubbabc 8618edc133 Minor changelog formatting. 2020-08-13 03:42:24 +02:00
blablubbabc df9eea3516 Prepared working on the next version. 2020-08-13 02:49:49 +02:00
blablubbabc 0b768d9ed0 Version 2.11.0 2020-08-13 02:47:39 +02:00
blablubbabc b8ad29b8f4 Updated update checklist. 2020-08-13 02:47:16 +02:00
blablubbabc d370b6251a Update for MC 1.16.2.
Config: Added piglin brute to the by default enabled mob types.
2020-08-13 02:46:56 +02:00
blablubbabc afd75af81e Most block and entity shop object types share the same object ids now.
The idea is that this might allow for optimization when doing shopkeeper lookups: Previously we had to create and check object ids for all shop object types in order to check if a block or entity is a shopkeeper of a certain type. We still have to go through all registered shop object types, but we can skip those which use the default ids.

However, as of right now this doesn't seem to make much of a difference. In a future step we could further optimize this by caching all object types which use non-default object ids.

Also, some default method implementations were moved into AbstractBlockShopObject and AbstractEntityShopObject.
2020-08-09 02:00:49 +02:00
blablubbabc cf25aa9f36 Minor: All type registries (shop types, shop object types, UI types, ..) remember the order of their registered types now. 2020-08-09 00:57:58 +02:00
blablubbabc b16db3d31f Fixed: Monster shopkeepers no longer burn when standing in sunlight.
Monsters usually get set on fire quite frequently when standing in sunlight. We therefore give zombies and skeletons a stone button as helmet now. This prevents them from getting set on fire in sunlight, by which we have to process less EntityCombustEvents. The stone button is also small enough to not be visible inside their head.

Entities standing in lava or fire are still set on fire as before.
2020-08-08 23:39:57 +02:00
blablubbabc f97d3bd1ce Notes on possible future additions. 2020-08-02 01:25:39 +02:00
blablubbabc faa3befa64 Minor refactoring related to the handling of wandering traders not supporting the baby state.
This is no handled similarly to parrots (which do not support the baby state either).

Also fixed: The villager editor will no longer show the baby editor option for wandering traders.
2020-08-02 01:03:13 +02:00
blablubbabc 18c5d79215 Added editor for regular villagers and wandering traders.
Any villagers and wandering traders which are not Citizens NPC or shopkeepers are considered 'regular'.

The editor supports editing the villager trades, similar to how editing works for admin shopkeepers. Note that trades created or edited via the editor will have infinite uses, no xp rewards, no price multipliers and the current uses counter gets reset to 0 (there are currently no options to edit or persist these attributes).
To not accidentally edit all original trades whenever the editor is opened and closed (and thereby change the above mentioned trade attributes), we compare the trades from the editor with the villager's current trades before applying the trades from the editor: If the items of a trade are still the same, we keep the original trade without changes. A message indicates how many trades have been modified.

Since villagers may change their trades whenever they change their profession, we set the villager's xp to at least 1 whenever the villager's trades or profession have been modified via the editor.

If the villager is killed or gets unloaded while editing, any changes in the editor will have no effect.

Other supported villager editor options are:
* Deleting the villager entity.
* Opening a copy of the villager's inventory. Note that any changes to the opened inventory are not reflected in the villager's inventory currently (i.e. you can view, but not modify the villager inventory with this).
* Changing the villager profession. Changing the profession via the editor will keep the current trades.
* Changing the villager type (i.e. the biome specific outfit).
* Changing the villager level (i.e. the badge color). This also affects which level is displayed and whether the villager's xp is shown within the villager's trading UI.
* Toggling the villager's AI on and off. This is useful to make the villager stationary while editing it. Otherwise it may wander away.

Related changes:
* Permissions: Added `shopkeeper.edit-villagers` and `shopkeeper.edit-wandering-traders` (default: `op`). These are required to edit regular villagers or wandering traders respectively.
* Added command `/shopkeeper editVillager [villager]`. This opens an editor to edit the specified villager / wandering trader. The villager / wandering trader can either be specified by uuid or by looking at it.
* Config: Added settings `edit-regular-villagers` and `edit-regular-wandering-traders` (default: `true`). With these settings enabled the villager editor can be opened by simply sneaking and right-clicking a regular villager (similar to how editing works for shopkeepers).

Various related internal changes:
* Added new command arguments to specify an entity by uuid.
* Added new command arguments to select a targeted entity.
* Moved and added some merchant and trading recipe related utilities into MerchantUtils.
* Minor changes to the comparison of merchant recipes.
* Moved the shopkeeper metadata key constant into ShopkeeperUtils.
* Added ItemUtils#getOrEmpty(ItemStack).
* ShopkeeperUIHandler is an interface now. This allows for more flexibility in the class hierarchy of UI handlers. Added a basic implementation 'AbstractShopkeeperUIHandler'.
* Removed the unused SKDefaultUITypes#register() method.
* Various refactoring related to the editor UI. There is now a separate base class for the shared implementation of the shopkeeper editor and the new villager editor UI. Any shopkeeper references had to be removed from the base class. All existing shopkeeper editor buttons had to be slightly adapted to this change.

Other changes:
* Minor fix: If the second buy item of a trading recipe is empty, the corresponding created merchant recipe stores that as an empty second ingredient now. This should help when checking if the existing merchant recipes still match the newly created merchant recipes and thereby cause less recipe updates that are not actually required.

Added messages:
* msg-missing-edit-villagers-perm
* msg-missing-edit-wandering-traders-perm:
* msg-must-target-entity
* msg-must-target-villager
* msg-target-entity-is-no-villager
* msg-villager-editor-title
* msg-villager-editor-description-header
* msg-villager-editor-description
* msg-button-delete-villager
* msg-button-delete-villager-lore
* msg-button-villager-inventory
* msg-button-villager-inventory-lore
* msg-button-mob-ai
* msg-button-mob-ai-lore
* msg-villager-inventory-title
* msg-set-villager-xp
* msg-no-villager-trades-changed
* msg-villager-trades-changed
* msg-command-description-edit-villager
2020-08-02 00:39:47 +02:00
blablubbabc 0919eb5a36 Fixed: The UI type of the dummy UI handler can no longer be null.
We therefore also create a dummy UI type now.
2020-08-01 03:15:15 +02:00