Closed Suhkur closed 6 months ago
Thanks for letting me know. I will try to consider this in the next update :)
This turned out much trickier than expected. I was not yet able to change this unfortunately :(
Will have a look at it again in the future.
This is the relevant part in the code. I'm open for any suggestions on how to detect the amount of trades that happened when a MOVE_TO_OTHER_INVENTORY
action (shift-click) happened.
This turned out much trickier than expected. I was not yet able to change this unfortunately :(
Will have a look at it again in the future. This is the relevant part in the code. I'm open for any suggestions on how to detect the amount of trades that happened when a
MOVE_TO_OTHER_INVENTORY
action (shift-click) happened.
Would it not be possible to search for the trader hook itself and count from there?
If the user sells an item, Once sold, it counts. If the user uses shift and sell, it will still be counting in the end as your looking at the sold hook of the trader and not at what the user has in his inventory.
Just wild thinking here. I'm new in the Minecraft world, but I do have a bit of coding knowledge.
Thanks for your comment @GamingHQ !
Sounds interesting. I'm not entirely sure what you mean by trader hook. Do you maybe have a documentation reference for me?
i'm afraid i dont have such documentation. The thing is when it comes on hooks, we use them for modding on rust for example. Hooks like "canentitytakedamage" or "OnGrowableGather" ( see Rust oxide API here of what I'm mentioning https://umod.org/documentation/games/rust#ongrowablegather )
i bet that there is a way to define the hook that we need to use for it. Something like "OnItemSold" is something to look after if there would be a such way of modding. I mean, all i have used is a few bukkit plugins and that's about it. I do have heard that modding on Minecraft can be a bit tricky, so if my thoughts are fully non-valid as it's impossible to mod or code that way in Minecraft, my apologies ofc!
i actually just found something to look deeper into. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/WanderingTrader.html
You could listen to this hook and determine if an item would be sold.
Finally fixed this issue! Came up with a neat workaround to calculate the number of trades that happened based on the amount of XP the villager gained. This will be incorporated in the next patch v0.5.1.
Shift click trading counts only as 1 progress