Commit Graph

1330 Commits (master)

Author SHA1 Message Date
blablubbabc 1d6ede58bc Fixed: Trading via shift-clicking while the player is charging a trident
would allow the player to duplicate the trident.

The problem is that Inventory#setStorageContents updates all inventory
slots (even those that haven't actually changed) and Minecraft is not
able to deal with changes to the currently used ItemStack instance.

The fix is to only update those slots that have actually changed by
comparing the new inventory contents with the current ones before
updating individual slots. This also has the minor benefit of not having
to send the player inventory slot update packets for slots that haven't
actually changed.

This only works if the active item is not actually affected by the
inventory manipulation.
2020-03-04 18:36:04 +01:00
blablubbabc 0e0c6bb523 Fixed: The 'active shopkeepers' would not get properly cleaned up in some occasions (even on shopkeeper removal) if the shopkeeper mob got deleted or the shop object was no longer considered 'active' for some other reason.
A side effect of this was that the shopkeeper entity would get respawned, even though it was not supposed to get spawned or even after the shopkeeper was already deleted.
This was resolved by remembering the last object id we stored the shopkeeper by.
2020-02-02 23:24:58 +01:00
blablubbabc ba53004cfc Fixed a potential CME when shopkeepers get removed after their shop chest got deleted. 2020-02-02 22:42:16 +01:00
blablubbabc cd21995b19 Added: If the setting 'delete-shopkeeper-on-break-chest' is enabled,
player shopkeepers will now periodically (roughly once every 5 seconds)
check if their chest is still present and otherwise delete themselves.

This allows them to detect when other plugins, such as WorldEdit, remove
the shop chest.
The setting 'deleting-player-shop-returns-creation-item' applies to
these checks as well and controls whether to drop a shop creation item
for every removed shopkeeper.

Internal:
* Added AbstractShopkeeper#tick which gets invoked roughly once per
second for all shopkeepers in currently active chunks.
2020-02-02 22:39:05 +01:00
blablubbabc fbca187fc5 Fixed: The selling and book shops attempted to convert currency items
into high currency items even if the high currency got disabled.
2020-01-31 19:43:22 +01:00
blablubbabc ba3983a103 Fixed: The DerivedSettings use the default value for the name-regex
setting during initialization now to properly catch user errors during
the subsequent setup after the config has already been loaded.
2020-01-25 16:17:25 +01:00
blablubbabc 6ac12dc7d0 Prepared working on next version. 2020-01-22 22:10:29 +01:00
blablubbabc dc59e6fab8 Version 2.9.1 2020-01-22 22:07:02 +01:00
blablubbabc fdd6088c7c Trading offer and hire cost items get automatically migrated to the current data version now.
This will typically occur with every (even minor) minecraft updates. A warning is logged if an offer could not be migrated.

Added debug option 'item-migrations' to log whenever a shopkeeper performs item migrations.
2020-01-22 19:20:31 +01:00
blablubbabc 5daecfd705 Added warning messages when a trading offer cannot be loaded for some reason. 2020-01-22 17:27:06 +01:00
blablubbabc 7988e5273e Bumped CraftBukkit dependency for MC 1.15 to 1.15.2. 2020-01-22 00:11:01 +01:00
blablubbabc d6344dd80a Added support for lazy error messages in Validate. 2020-01-16 02:46:22 +01:00
blablubbabc b984971732 Replaced the NMS call for setting the CanJoinRaid property on MC 1.15.x
with a corresponding Bukkit API call.

This only works on the very latest versions of MC 1.15.1 and upwards.
2020-01-15 22:49:44 +01:00
blablubbabc 84268d871c TradingHandler logic might no longer be up-to-date. 2020-01-08 02:48:48 +01:00
blablubbabc 9df995006a Changelog formatting. 2019-12-28 07:38:24 +01:00
blablubbabc 5fefef4079 Prepared working on the next version. 2019-12-28 07:37:45 +01:00
blablubbabc 94b3784497 Version 2.9.0 2019-12-28 07:16:41 +01:00
blablubbabc c9e537bcb9 Changelog formatting and minor cleanup. 2019-12-28 07:16:34 +01:00
blablubbabc ab8cd2226e Actually prevent raider shopkeepers from joining raids.
Fixes the last commit.
2019-12-28 06:15:49 +01:00
blablubbabc 1bf09f11b6 Fixed: Raider shopkeeper mobs were able to join and thereby interfere with nearby raids.
This should no longer be the case.
2019-12-28 05:48:22 +01:00
blablubbabc 3c43b7ffd5 Villager shopkeepers get their experience set to 1 now.
I wasn't able to reproduce this myself yet, but according to some reports villager shopkeepers would sometimes lose their profession.
Setting their experience to something above 0 is an attempt to resolve this.
2019-12-28 05:03:54 +01:00
blablubbabc f79b1a6da1 Fixed: Inconsistent UI state when interacting with shopkeepers while holding a written book in hand.
Due to a Minecraft bug (MC-141494) interacting with a villager while holding a written book in the main or off hand results in weird glitches and tricks the plugin into thinking that the editor or trading UI got opened even though the book got opened instead.
We therefore ignore any interactions with shopkeeper mobs for now when the interacting player is holding a written book.
2019-12-28 01:43:41 +01:00
blablubbabc 9bfb6efff7 Spigot seems to (internally) support books with empty titles now.
The book shopkeepers were updated to ignore them, since supporting them would require fundamental changes to how book prices are stored and how books are identified.
Those books can't be created in vanilla Minecraft, so this shouldn't be a severe limitation.
2019-12-27 23:53:42 +01:00
blablubbabc 4e7342fa35 The debugCreateShops command prints the number of actually created shops now. 2019-12-27 23:08:46 +01:00
blablubbabc 921cc81fa1 Fixed: The save file was missing the data-version when initially created.
This caused subsequent reloads to always trigger a 'migration' / forced without actually being required.

Other internal change:
The save task was using a copy of the save data to protect against concurrent modifications while an async save is in progress.
However, since the actual save data did not get modified during ongoing saves anyways, this copy is redundant and was therefore removed.
2019-12-27 23:08:20 +01:00
blablubbabc c8c7ea2b33 All concatenated debug messages get lazily created only when actually required.
Minor (mostly formatting) changes to a few debug messages.
2019-12-27 20:39:55 +01:00
blablubbabc 88278d6105 Checking for invalid name-regex and then reverting back to default. 2019-12-27 19:57:40 +01:00
blablubbabc 677a811833 Added debug option 'owner-name-updates'.
This enables additional output whenever stored shop owner names get updated.
2019-12-27 19:29:26 +01:00
blablubbabc 7e930a8027 Update Spigot build script to latest BuildTools changes.
It is required now to explicitly specify whether to also build
CraftBukkit.
2019-12-27 06:26:44 +01:00
blablubbabc 78ddff2b2b Changelog formatting. 2019-12-27 06:15:28 +01:00
blablubbabc 589e5493c5 The always-show-nameplates setting seems to be working again (since MC 1.9 already).
Updated the corresponding comment in the default config.
2019-12-27 05:58:23 +01:00
blablubbabc 0bdff6656e Fix: Also handle potentially missing generations when copying books. 2019-12-27 05:56:10 +01:00
blablubbabc 5b99037944 Update for Minecraft 1.15.1
Added bees to the by default enabled mob types.
If you are migrating from a previous version, you will have to manually enable them in the config.
2019-12-27 05:29:44 +01:00
blablubbabc c1351c084f Missing changes in TradeFileLogger. 2019-12-27 04:16:03 +01:00
blablubbabc f24c33a14a Missing Text changes.
Comment not yet used shopkeeper message args method.
2019-12-27 04:13:20 +01:00
blablubbabc 870b7a1c36 Formatting. 2019-12-27 04:03:33 +01:00
blablubbabc dad7725c5b Minor changelog changes. 2019-12-27 03:53:54 +01:00
blablubbabc 84176f1f49 Various command and text changes.
Command changes:
* Changed: The list and remove commands accept player uuids now and ignore the case when comparing player names.
* Changed: The list and remove commands handle ambiguous player names now: If there are shops of different players matching the given player name, an error message is shown and the player needs to be specified by uuid instead. If a player with matching name is online, that player is used for the command (regardless of if the given player name is ambiguous).
* Changed: The shops affected by the remove command are now determined before asking for the users confirmation. This allows detecting ambiguous player names and missing player information before prompting the command executor for confirmation. A minor side effect of this is that any shops created after the command invocation are no longer affected by the remove command once it gets confirmed.
* Internal: Refactored ObjectIdArgument and all player/shopkeeper name/uuid/id arguments.
  * Added ObjectByIdArgument which contains most of the shared logic now.
  * Added ShopkeeperIdArgument.
  * Added TransformedArgument which allows transforming of parsed arguments.
  * Various refactoring to name/id matching.

Text changes:
* Added: The list and remove commands now show the player's uuid as hover text and allow it to be copied into the chat input via shift clicking.
* Internal: Made various changes in order to support Minecraft's text features such as hover events, click events, insertions, etc.:
  * Text was changed to more closely match the behavior of text with legacy color codes.
  * Most texts are now parsed and stored in a new format internally.
  * Text and TextBuilder allow for fluent Text construction.
  * Moved everything Text related into separate package.
  * SpigotText isn't used directly anymore, but via TextUtils.
  * The commands library was updated to use the new text representation everywhere now.
* Internal: Various changes to TextUtils and argument replacement:
  * Arguments can be arbitrary objects now and Suppliers can be used to dynamically lookup argument values.
  * By iterating over the input String only once and using a map for argument lookup, the replacement of arguments in plain text should be faster now.
  * Placeholders in the new Text-based text get parsed only once at plugin startup and use a Map based argument lookup as well, so replacement should be faster there as well.
  * Placeholder keys are now specified without the surrounding braces.
  * Moved newline pattern and splitting into StringUtils.
  * Started moving common shopkeeper message arguments into AbstractShopkeeper. But this is not used yet.
* Added a few StringUtils and Text tests.

Changed messages:
* Added {shopsCount} argument to shop removal confirmation messages:
  * msg-confirm-remove-admin-shops
  * msg-confirm-remove-own-shops
  * msg-confirm-remove-player-shops
  * msg-confirm-remove-all-player-shops

New messages:
* msg-ambiguous-player-name
* msg-ambiguous-player-name-entry
* msg-ambiguous-player-name-more
2019-12-27 03:45:36 +01:00
blablubbabc 0651bcd39f Additions to Validate utility. 2019-12-27 01:45:39 +01:00
blablubbabc df91a77ed0 Renamed AbstractTestBase to AbstractBukkitTest. 2019-12-26 01:10:35 +01:00
blablubbabc 1b992c5af3 Fixed: The book shopkeeper was ignoring books with missing generation tag.
These are now treated as 'original' books, just like minecraft does.
2019-12-14 23:32:28 +01:00
blablubbabc fbc720a800 Changed: The errors about a potentially incompatible server version and trying to run in compatibility mode are warnings now. 2019-12-14 19:45:07 +01:00
blablubbabc cdad83b33d New AbstractSet/List/Collections are already unmodifiable by default. 2019-11-26 16:32:08 +01:00
blablubbabc 29e3699bdf Formatting. 2019-11-18 21:04:24 +01:00
blablubbabc 69e98588ca Various changes to ShopkeeperRegistry and shopkeeper activation.
* The delayed chunk activation tasks get cancelled now if the chunk gets unloaded again before it got activated. This resolves a few inconsistencies such as duplicate or out-of-order chunk activation and deactivation handling when chunks get loaded and unloaded very frequently.
* Similarly the respawn task on world saves gets cancelled now if the world gets unloaded.
* Shopkeeper spawning is skipped if there is a respawn pending due to a world save.
* Shopkeepers are now stored by world internally. This might speed up a few tasks which only affect the shopkeepers of a specific world.
* Config: Added debug option 'shopkeeper-activation'. Various debug output related to chunk/world loading/unloading/saving and spawning/despawning of shopkeepers was moved into this debug category.
* Debug messages are now created lazily only when they are actually required.
* Added/Debug: The "/shopkeepers check" command now outputs some additional information on active chunks.
* Internal: Moved all logic from WorldListener into SKShopkeeperRegistry.
* Internal: Various internally used methods are now hidden.
* API: Various changes to ShopkeeperRegistry. See the changelog.

TODO: A follow-up commit will fix the usage of ShopkeeperRegistry#getShopkeeperByName.
2019-11-18 15:12:29 +01:00
blablubbabc 9ab2c63ce5 API: Added PlayerShopkeeper#getChestX/getChestY/getChestZ 2019-11-18 03:50:22 +01:00
blablubbabc ece5b547ce Fixed an issue with the new Spigot text feature.
Started using the new Spigot text feature at a few places:
The give and transfer command show the player's uuid as hover text now and allow it to be copied into the chat input via shift clicking.
List and remove commands follow soon.

Also:
* Fixed: FeaturesChart was missing the CollectionUtils rename.
2019-11-12 14:35:17 +01:00
blablubbabc 69d9bd045f Renamed CollectionUtils to MapUtils.
Added MapUtils#entry(K, V).
2019-11-12 01:00:48 +01:00
blablubbabc 5703376e60 The msg-shop-creation-items-given message was using the player's display name.
This was changed to use the player's regular name to be consistent with the rest of the plugin.
2019-11-12 00:39:30 +01:00
blablubbabc 19c5d6a512 Fixed: The command debug output would throw an error for an ArgumentParseException without an attached argument. 2019-11-11 20:58:58 +01:00