Commit Graph

990 Commits (master)

Author SHA1 Message Date
ChimneySwift 269ebdef93 Avoid attempting to access unloaded chunks 2020-12-26 01:14:42 +10:00
blablubbabc 855a7f6509 Added utilities for formatting and parsing values to ValueType. 2020-11-28 21:38:29 +01:00
blablubbabc 2506683576 Added notes about possible TODOs. 2020-11-28 21:34:33 +01:00
blablubbabc 37c39a9671 Refactor: 'SettingLoadException' -> 'ValueLoadException'. 2020-11-28 20:58:57 +01:00
blablubbabc 55ed27979e Refactor: Improved handling of unknown materials and issues during ItemData deserialization. 2020-11-28 17:45:33 +01:00
blablubbabc cb843307da Simplified SettingLoadExcpetion by removing the multi-line error handling. 2020-11-28 16:53:44 +01:00
blablubbabc cf07e1efa4 Refactor: Moved more debugging utilities into new debug package. 2020-11-28 16:26:15 +01:00
blablubbabc 4e51fcb374 Refactor: Moved debug handling from Settings into separate package. 2020-11-28 16:21:03 +01:00
blablubbabc 0d07847990 The validation for unknown messages takes potential config subsections into account now. 2020-11-28 15:51:39 +01:00
blablubbabc f9c565b110 Major refactoring related to how the config and language files are loaded. 2020-11-28 01:27:11 +01:00
blablubbabc 68dbd0c521 Refactor: Moved all code related to the replacement of text arguments from TextUtils into StringUtils. 2020-11-26 15:23:22 +01:00
blablubbabc cc3f82b9ab Removed message 'sign-shop-first-line' from the config and replaced it with 8 new messages inside the language files.
* 'admin-sign-shop-line1/2/3/4'
* 'player-sign-shop-line1/2/3/4'

This gives more control over the sign contents of admin and player shop signs.
The default appearance of sign shops has also changed. They are slightly more colorful now.
2020-11-26 15:12:13 +01:00
blablubbabc b90bfe1ad0 Minor changes to the german translation. 2020-11-25 23:41:33 +01:00
blablubbabc df7ac282e3 Moved the setting 'nameplate-prefix' from the config into the language files.
Also changed the color to a dark green.
There is also no need to check if the prefix is null or empty, since it is supposed to never be null.
2020-11-25 23:39:52 +01:00
blablubbabc 9c678b58c4 Simplified the regex pattern that is used to convert field names to config keys.
Also added some documentation and examples.
2020-11-25 22:21:39 +01:00
blablubbabc 685fd96586 Fixed: Enabled living shops specified inside the config would previously not get enabled if they were not perfectly matching the entity type name.
The enabled living shop types get validated and cached as part of the derived settings now.

Also: Removed the 1.16 'PIG_ZOMBIE' migration. We no longer automatically remove this mob type from the config, but only log a warning and then ignore it.

Also refactoring: Moved the validation of settings into a separate method.
2020-11-25 03:08:41 +01:00
blablubbabc d50bfaa4d1 Refactor: Moved code related to loading the config into Settings class. 2020-11-25 02:43:42 +01:00
blablubbabc 73173d4525 Minor formatting (moving code around) in Settings class. 2020-11-25 02:42:03 +01:00
blablubbabc 5499cbdcc7 Derived settings are also initially setup for the default values now.
This also avoids some code duplication for these default values.
2020-11-25 02:34:22 +01:00
blablubbabc c193160c51 Moved entity type id matching into EntityUtils. 2020-11-25 02:30:36 +01:00
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 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 d39f153a92 Minor change fix for consistency reasons. 2020-08-21 18:29:57 +02:00
blablubbabc 6d369eda1d Added some more examples for the name-regex setting. 2020-08-21 18:16:42 +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 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