Updated ShopKeeperCreatedScriptEvent to modern handling & meta.
Removed listening to PlayerCreatePlayerShopkeeperEvent in ShopKeeperCreatedScriptEvent, as it already listens to PlayerCreateShopkeeperEvent which it extends.
ShopKeeperCreatedScriptEvent#onShopKeeperCreated -> onPlayerCreateShopkeeper (convention, should match the event name).
Updated ShopKeeperTradeScriptEvent to modern handling & meta.
Removed redundant player field from ShopKeeperTradeScriptEvent and PlayerCreateShopkeeperEvent.
Improved ShopKeeperTag#valueOf errors.
Added a starts with prefix -> true check in ShopKeeperTag#matches.
Simplified ShopKeeperTag#isShopKeeper - use ShopkeepersAPI instead of casting the bridge's plugin instance, and one-line the check.
Minor improvement to ShopKeeperTag#fromEntity - Null check ShopkeeperRegistry#getShopkeeperByEntity instead of checking if it's a shopkeeper twice (ShopkeeperRegistry#isShopkeeper just checks if getShopkeeperByEntity isn't null).
Fixed null handling in ShopKeeperTag#getDenizenEntity - it was treated as non-null, but ShopKeeperTag#getBukkitEntity can return null.
Minor cleanup to ShopKeeperTag#getBukkitEntity - one-line it using instanceof pattern matching.
Updated ShopKeeperTag to modern tag handling (ObjectTagProcessor + register method).
Minor meta fixes in ShopKeeperTag, notably the return type in ShopKeeperTag.trades and ShopKeeperTag.entity being nullable.
Implemented getJavaObject in ShopKeeperTag.
Implemented debuggable in ShopKeeperTag.
Slightly moved methods around in ShopKeeperTag to have less relevant methods like prefix stuff at the bottom.
Updated ShopKeepersEntityProperties to a modern ShopKeepersEntityExtensions extension class.
Fixed EntityTag.shopkeeper meta - it can return null if the entity isn't a shopkeeper, and added a reference to is_shopkeeper.
Updated ShopKeeperTag.trades to use the ListTag convertor constructor.
It seems a shopkeeper's UI being active isn't a single set value anymore but managed per UI session - used a Stream#anyMatch to update ShopKeeperTag.is_ui_active for now, and added a TODO for better handling.
Shopkeeper#isActive was removed in favor of ShopObject#isActive, so updated ShopKeeperTag.is_active for that.
Notes
Do we want to deprecate EntityTag.is_shopkeeper in favor of EntityTag.shopkeeper + fallbacks?
Based on bug report on Discord.
Changes
Shopkeepers
dependency to2.16.6
.ShopKeeperTag#wrapTradingRecipe
->ShopkeepersBridge#tradingRecipeToList
.ShopKeeperCreatedScriptEvent
to modern handling & meta.PlayerCreatePlayerShopkeeperEvent
inShopKeeperCreatedScriptEvent
, as it already listens toPlayerCreateShopkeeperEvent
which it extends.ShopKeeperCreatedScriptEvent#onShopKeeperCreated
->onPlayerCreateShopkeeper
(convention, should match the event name).ShopKeeperTradeScriptEvent
to modern handling & meta.player
field fromShopKeeperTradeScriptEvent
andPlayerCreateShopkeeperEvent
.ShopKeeperTag#valueOf
errors.true
check inShopKeeperTag#matches
.ShopKeeperTag#isShopKeeper
- useShopkeepersAPI
instead of casting the bridge's plugin instance, and one-line the check.ShopKeeperTag#fromEntity
- Null checkShopkeeperRegistry#getShopkeeperByEntity
instead of checking if it's a shopkeeper twice (ShopkeeperRegistry#isShopkeeper
just checks ifgetShopkeeperByEntity
isn't null).ShopKeeperTag#getDenizenEntity
- it was treated as non-null, butShopKeeperTag#getBukkitEntity
can return null.ShopKeeperTag#getBukkitEntity
- one-line it usinginstanceof
pattern matching.ShopKeeperTag
to modern tag handling (ObjectTagProcessor
+register
method).ShopKeeperTag
, notably the return type inShopKeeperTag.trades
andShopKeeperTag.entity
being nullable.getJavaObject
inShopKeeperTag
.debuggable
inShopKeeperTag
.ShopKeeperTag
to have less relevant methods like prefix stuff at the bottom.ShopKeepersEntityProperties
to a modernShopKeepersEntityExtensions
extension class.EntityTag.shopkeeper
meta - it can return null if the entity isn't a shopkeeper, and added a reference tois_shopkeeper
.ShopKeeperTag.trades
to use theListTag
convertor constructor.Stream#anyMatch
to updateShopKeeperTag.is_ui_active
for now, and added aTODO
for better handling.Shopkeeper#isActive
was removed in favor ofShopObject#isActive
, so updatedShopKeeperTag.is_active
for that.Notes
EntityTag.is_shopkeeper
in favor ofEntityTag.shopkeeper
+ fallbacks?