Commit Graph

1330 Commits (master)

Author SHA1 Message Date
blablubbabc 750318a061 Minor changelog changes. 2020-07-03 01:05:04 +02:00
blablubbabc 0016165470 When giving items via command to another player we now also inform the target player that he has received items.
These newly added messages are also used now when giving items to yourself.

Added messages:
* msg-shop-creation-items-received
* msg-currency-items-received
* msg-high-currency-items-received
2020-07-02 19:04:58 +02:00
blablubbabc 7ba369c9a9 Added 'givecurrency' command.
Added corresponding permission node `shopkeeper.givecurrency` (default: op).
Added messages:
* msg-currency-items-given
* msg-high-currency-items-given
* msg-high-currency-disabled
* msg-command-description-give-currency
2020-07-02 18:28:49 +02:00
blablubbabc bb24919aa6 Fixed: TypedFallbackArgument was missing some delegations.
This has (among other things) fixed the issue that various optional (context dependent) command arguments were shown to be required inside the Shopkeepers command help.

Also: Missing Override annotation in AnyFallbackArgument.
2020-07-02 18:21:27 +02:00
blablubbabc f7b7d4cc73 Added editor options to change the size of slimes and magma cubes.
Their default size is 1 (tiny). Even though Minecraft theoretically allows sizes up to 256, we limit the max size to 10. This avoids running into issues such as related to rendering, performance and not being able to interact with the slime or magma cube.
This also fixes the issue of slimes and magma cubes spawning with random size everytime they are respawned.

Added messages:
* msg-button-slime-size
* msg-button-slime-size-lore
* msg-button-magma-cube-size
* msg-button-magma-cube-size-lore

Internal: Slightly changed how we cycle through the villager levels (badge colors).
2020-06-30 16:26:29 +02:00
blablubbabc 84695ee555 Added config option 'max-trades-pages' (default: 5, min: 1, max: 10).
This setting allows changing the number of pages that can be filled with
trading options.

This limit applies to all shopkeepers (there are no different settings
for different types of shops or different permission levels so far).

This allows for up to 90 trades per shopkeeper now. Note: This seems to
work fine. However, the scroll bar rendered by the
Minecraft client will only work nicely for up to 64 trades.
2020-06-30 04:24:12 +02:00
blablubbabc 19f899e3bb Minor changelog fixes. 2020-06-27 00:20:53 +02:00
blablubbabc eeb5cce752 Prepared working on the next version. 2020-06-27 00:20:40 +02:00
blablubbabc d3771a7042 Version 2.10.0 2020-06-26 23:56:02 +02:00
blablubbabc 7d2594e348 Fixed: When a mob randomly spawns with a passenger, this would previously interfere with our 'bypass-spawn-blocking' feature.
We would receive a warning inside the log then about an unexpected entity (the passenger) being spawned.

This has been fixed by moving the call to 'forceCreatureSpawn' into the entity's preparation callback, after the entity has already randomly spawned its passengers and right before this specific entity is about to get spawned.
2020-06-26 23:52:48 +02:00
blablubbabc 1def7dc408 Changes to the handling of shopkeeper data migrations.
We use a combination of our own 'Shopkeepers data version' (which has been bumped to 2) and Minecraft's data version for the data version stored inside the save.yml now.

Minecraft's data version is incremented on every Minecraft release (including minor updates) and may indicate that new item migrations have been added. So whenever you update your server, we automatically trigger a full migration of all your shopkeepers data to ensure that your save.yml is always up-to-date.

Also: Added a note about the migration of 'ZOMBIE_PIGMAN_SPAWN_EGG' items to 'ZOMBIFIED_PIGLIN_SPAWN_EGG' items to the changelog. Spigot automatically migrates any 'ZOMBIE_PIGMAN_SPAWN_EGG' items inside the shopkeepers data. With the above change we also ensure that the migration results get saved back to the save.yml file in all cases.
2020-06-26 22:55:52 +02:00
blablubbabc 496b3761f8 Added support for the new crimson and warped sign variants.
We no longer use Bukkit's (now outdated) TreeSpecies enum to represent the available sign/wood types. Instead we use our own 'SignType' enum.
Sign shops of type 'GENERIC' and 'REDWOOD' are migrated to 'OAK' and 'SPRUCE' respectively.
When loading the sign type from the storage we verify that the loaded type is both valid and also supported on the currently used server version.

Also:
* Added the debug option 'capabilities', which logs additional details when the plugin checks for server version dependent capabilities.
* Added a note to the changelog regarding Minecrafts new chat features not being supported yet.
2020-06-26 16:30:09 +02:00
blablubbabc 186711941b Update for MC 1.16.1
* Bumped version to 2.10.0-SNAPSHOT.
* Added zombified piglin, piglin, hoglin, zoglin and strider to the by default enabled mob types. If you are updating, you will have to manually add these to your config's 'enabled-living-shops' setting.
* During my quick initial testing I did not encounter any major issues with these new mobs, but there are some oddities you might want to be aware of:
  * We don't support changing the baby property of piglin and zoglin shopkeepers yet. However, we at least ensure that they always spawn as adult.
  * The zombified piglin, hoglin and strider already support changing the baby property.
  * The strider constantly shakes when being spawned outside the nether and randomly spawns with saddle.
* The pig zombie mob type has been removed from the by default enabled mob types. If you are updating to MC 1.16, it will get automatically removed from your config. To prevent your config from losing its comments and formatting during this small migration, consider manually removing this mob type before your update.
* If you are updating to MC 1.16, your pig zombie shopkeepers get automatically converted to zombified pigman shopkeepers.
* Internal: Any internal references to the pig zombie mob type have been removed to prevent any kind of binary problems to arise.

Other changes:
* Improved/Fixed: Some mobs randomly spawn with passengers. We remove those passengers now.
2020-06-26 13:01:42 +02:00
blablubbabc ae14c09ff1 Fixed: The random equipment of certain mobs gets properly cleared now.
For instance, this resolves the issues of foxes randomly carrying items inside their mouth.
2020-06-26 10:51:50 +02:00
blablubbabc b8863d32dd Removed the config migration from legacy (pre MC 1.13) item types, data values and spawn eggs to corresponding item types in MC 1.13.
Instead any unknown item types get migrated to their default now.
2020-06-26 10:46:32 +02:00
blablubbabc d81c6eefa7 Internal: Added a note about a certain assertion. 2020-06-26 08:29:17 +02:00
blablubbabc f5efc14e23 Various refactorings related to Citizens shopkeepers.
* Fixed: When a Citizens NPC, created without the 'shopkeeper' trait, is deleted, we immediately delete any corresponding shopkeeper now. Previously the corresponding shopkeeper would not get deleted right away, but only during the next plugin startup (when checking whether the corresponding NPC still exists). Any chest used by the shopkeeper would remain locked until then.
* Improved: In order to determine the player who is setting up a shopkeeper via the 'shopkeeper' trait, we previously only took players into account which are adding the trait via the Citizens trait command (NPCTraitCommandAttachEvent). However, players are also able to add traits during NPC creation. We now also react to player's creating NPCs (PlayerCreateNPCEvent) and then (heuristically) assume that any directly following trait additions for the same NPC within one tick are caused by this player. This player will then be able to receive feedback message about the shopkeeper creation.
* Improved: For any trait additions not directly associated with a player, we previously waited 5 ticks before the corresponding shopkeeper got created. One (minor) side effect of the above change is that we react to all trait additions within 1 tick now.
* Debug: Minor changes to some debug messages.
* Internal: When the shop object is deleted, we explicitly check if there still is a corresponding NPC and otherwise abort right away.
* Internal: Moved the common code for looking up the corresponding shopkeeper for a given NPC into CitizensShops#getShopkeeper(NPC).
* Internal: The constructor of the shopkeeper trait refers the TRAIT_NAME constant to get its trait name now.
* Internal: Minor formatting, renaming and clarifications.
2020-06-26 08:08:11 +02:00
blablubbabc 86c642ad2a Removed the note about left and right clicking items to adjust amounts from the 'msg-trade-setup-desc-admin-regular' message.
This doesn't actually apply to admin shops.
2020-06-25 19:54:38 +02:00
blablubbabc 9d525192e6 Added a link inside the config which points to the translations repository. 2020-06-25 18:53:16 +02:00
blablubbabc da290f9f1a Changed: Creative mode players are ignored when checking for entity interactions with the shop creation item.
Also, the permission check is performed first now since we expect this check to be quite fast.
2020-06-25 18:50:38 +02:00
blablubbabc c68be20af5 Added more feedback messages when a player cannot trade with a shop for some reason.
Added the messages 'msg-cant-trade-with-own-shop' and 'msg-cant-trade-with-shop-missing-chest' for the cases that trading with the own shop is prevented or if the target shop is missing its chest.

Also:
* The check for whether the player is able to bypass the restriction of not being able to trade with own shops was previously checking if the player is an operator. Instead we now check if the player has the bypass permission.
* When checking if the player is able to bypass the restriction of not being able to trade with shops while their owner is online, we only check for the bypass permission now after checking if the shop owner is actually online currently.
* Slightly changed the german translation of the 'msg-cant-trade-while-owner-online' message.
2020-06-25 17:10:14 +02:00
blablubbabc f79d06d32f Added: The variant of rabbit shopkeepers can now be changed.
Any existing rabbit shopkeepers will use the brown variant (the default).
This also resolves an issue with the rabbit type randomly changing whenever the shopkeeper is respawned.

Added messages:
* msg-button-rabbit-variant
* msg-button-rabbit-variant-lore
2020-06-25 16:20:12 +02:00
blablubbabc 56c4f17b00 Changed: The item representing the black horse inside the editor is now slightly less black. 2020-06-25 16:16:49 +02:00
blablubbabc 78394dbf71 Clarified the description of the villager level editor option.
Changed the 'msg-button-villager-level' and
'msg-button-villager-level-lore' messages to clarify that this option
only changes the visual appearance of the villager's badge color.
The included german translation has been updated accordingly as well.
2020-06-25 15:09:23 +02:00
blablubbabc 1b00111405 Added a header comment to the top of the save.yml file mentioning the
risk of manually editing this file while the server is still running or
without making a backup first.
2020-06-25 14:06:17 +02:00
blablubbabc 79eaa5e631 Various minor Text refactoring.
* Renamed TextText to PlainText.
* Added Text#setPlaceholderArguments(Object... argumentPairs) directly to Text.
* TextUtils#addArguments is public now and called TextUtils#addArgumentsToMap. It has some validation added to it.
* Removed the generic varargs type parameter from a few utlity methods inside TextUtils.
* Moved the next and child references up in the hierarchy into AbstractText. AbstractText#setParent is private now.
* Also moved various other common method implementations related to placeholders and plain text formatting into AbstractText.
* Minor javadoc changes, parameter renaming and formatting.
2020-06-25 13:21:58 +02:00
blablubbabc 018b783d41 Fixed: If regular item usage is disabled we also prevent any kind of
entity interaction now while holding the shop creation item in hand.

This resolves issues such as players being able to spawn baby mobs by
interacting with regular mobs while holding a spawn egg shop creation
item in hand (such as the default villager spawn egg shop creation
item). Other kinds of item and entity specific interaction behaviors and
the equipment of armor stands with shop creation items are blocked by
this change as well.

Players with the 'shopkeeper.bypass' permission are exempt from this
restriction.

Internal: Added ItemUtils#getItem(PlayerInventory, EquipmentSlot) method. This is also used within the BlockZombieVillagerCuringListener now. This utility method can be replaced with the corresponding Bukkit API method once we only support the latest versions of Bukkit 1.15.2 and upwards.
2020-06-12 02:38:43 +02:00
blablubbabc 4c5c031a7e Internal: Using a Set instead of a Map to store the virtual shopkeepers. 2020-06-06 17:11:32 +02:00
blablubbabc 3268fa4afa Added a note about the PlayerDeleteShopkeeperEvent not being called in
all circumstances.
2020-05-30 01:30:23 +02:00
blablubbabc e457cbf285 Internal: Added a few notes regarding the chat event handling for the naming of shopkeepers. 2020-05-22 00:20:05 +02:00
blablubbabc 0532dff524 Various small changes related to handling shopkeeper deletions.
* Fixed: The returned shop creation item would get dropped twice under certain conditions.
* Fixed: The shop creation item is now also returned if a player deletes his own shops via command.
* Fixed/API: The PlayerDeleteShopkeeperEvent is now also called when a player deletes shops via command.
* Changed: The result message after deleting shops via command will now print the number of actually removed shops (which does not necessarily match the number of shops that were confirmed for removal).
* Debug: Added some more information to the debug message that gets logged when the PlayerDeleteShopkeeperEvent has been cancelled.
* API/Internal: Added Shopkeeper#delete(Player) which optionally passes the player responsible for the shopkeeper deletion. Note that the player is not passed if a player shop is deleted due to a player breaking the shop's chest.

Internal changes:
* Moved most of the code responsible for returning the shop creation item for deleted player shops into the new PlayerShopkeeper#delete(Player) method.
* Added ShopkeeperEventHelper class and moved the common code for calling and handling PlayerDeleteShopkeeperEvents there.
* Minor formatting changes. Not applied to the whole code base yet.

Message changes:
* Renamed 'msg-removed-player-shops' to 'msg-removed-shops-of-player'.
* Renamed 'msg-removed-all-player-shops' to 'msg-removed-player-shops'.
* Renamed 'msg-confirm-remove-admin-shops' to 'msg-confirm-remove-all-admin-shops'.
* Renamed 'msg-confirm-remove-own-shops' to 'msg-confirm-remove-all-own-shops'.
* Renamed 'msg-confirm-remove-player-shops' to 'msg-confirm-remove-all-shops-of-player'.
* The 'msg-removed-player-shops' message (previously 'msg-removed-all-player-shops') no longer mentions that 'all' shops got deleted (since this is not necessarily true).
2020-05-21 19:45:13 +02:00
blablubbabc 1e0a0c6802 Minor javadoc fix. 2020-05-08 13:35:56 +02:00
blablubbabc 81922636aa Checking the WorldGuard allow-shop flag now takes into account the
player for whom the flag is being queried.
2020-04-17 06:31:13 +02:00
blablubbabc a0744056b5 Prepared working on the next version. 2020-04-12 20:06:01 +02:00
blablubbabc 44ea159c25 Version 2.9.3 2020-04-12 20:04:42 +02:00
blablubbabc 9e221793d8 Fixed: If a trade required two matching item stacks of the same type but
different sizes, it was possible to trade for less items when offering
the items in reverse order.
2020-04-12 19:49:29 +02:00
blablubbabc f418e42388 Slightly changed the german translation of the msg-command-description-give message. 2020-04-03 21:15:44 +02:00
blablubbabc 1893f04729 The `/shopkeeper remote` command can be used from console now and optionally accepts a player as argument.
The shop will then be opened for the specified player.

Opening shops for other players requires the new 'shopkeeper.remote.otherplayers' permission (default: op).
The msg-command-description-remote message has been adapted to the addition of the optional player argument.

Internal: The description of the shopkeeper.remote permission has been updated to reflect that this commands also works for non-admin shops.
2020-04-03 21:14:50 +02:00
blablubbabc 5fe1e2c8d7 Experimenting with automatically clearing the trading result slot in
case the trade is invalid or disallowed (eg. when using strict item
comparison).

However, it has turned out that this doesn't work, because the client
will reset the result slot whenever it receives any slot update from the
server (including when we try to explicitly overwrite the item inside
the result slot).
2020-03-19 18:08:44 +01:00
blablubbabc 991ce9c440 Utility method to update the inventory for all viewers. 2020-03-19 18:05:23 +01:00
blablubbabc 1d40ae5ffc The UISession keeps track now whether it is still valid 2020-03-19 18:04:57 +01:00
blablubbabc 24081f3328 Added heuristic detection of automatically triggered shift left-clicks
in order to ignore those inside the editor and hiring ui views.

The heuristic works by ignoring any shift left-clicks that occur within
250 ms on a slot different to the previously clicked. The time span
cannot be reduced much further because the automatically triggered click
events may be received quite some time after the manual click that
triggered them (up to 150 ms on a local server and likely even later
with network delay involved).
This also does not work with automatic clicks on the same slots, because
we cannot differentiate them from regular fast clicking.
2020-03-16 22:27:23 +01:00
blablubbabc 18e7499576 Prepared working on the next version. 2020-03-05 19:34:11 +01:00
blablubbabc d412e5cc3d Version 2.9.2 2020-03-04 23:58:02 +01:00
blablubbabc 32a6457965 Clarify on some remaining open issues. 2020-03-04 22:14:23 +01:00
blablubbabc 095445c9c6 Clarify changelog. 2020-03-04 19:47:23 +01:00
blablubbabc 4cf09058d9 Fixed: We cannot ignore cancelled interaction events. 2020-03-04 19:32:23 +01:00
blablubbabc 7688110fc1 Added debug output when canceling a player's interaction during an
active UI session.
2020-03-04 18:55:36 +01:00
blablubbabc b5ef00b72e More clarification.
The duplication issue has been resolved differently now.
2020-03-04 18:51:02 +01:00
blablubbabc 1935fe0c7e Fix: Cancel item interactions while interacting with a shopkeeper.
When a player interacts with a shopkeeper entity while holding an item
in hand, we may first receive the entity interaction event, which starts
an UI session, and then the interaction event for the item. To not start
any item actions for the held item (such as trident charging, food
consumption, etc.), we cancel any interaction events while an UI session
is already active.
2020-03-04 18:39:35 +01:00