Can items ONLY check name and NOT lore
RoloRotMG opened this issue ยท 1 comments
Preliminaries:
- Shopkeepers version:
Latest
- Spigot version:
Latest Paper
I used a plugin called QuantumRPG. This plugin allows me to set items that have a level and class requirement. The lore of the item changes from a tick to a cross depending on if you meet those requirements
The problem is this stops people selling armours to the NPCs because they don't meet the requirements. Would be amazing if there was a setting so all they need to do is meet the requirement of name and item ID
Not possible. The item comparisons done by the plugin have to match the vanilla Minecraft comparisons, because the client itself will do the same comparisons and otherwise not allow the player to trade / not display the result item / actively clear the result item. There is no way for me to override this, other than maybe faking item packets, which is out of scope for me to do as part of Shopkeepers (I don't consider the effort, additional complexity and new source of issues to be worth the benefit currently).
I don't know if this is a realistic suggestion, but since the QuantumRPG plugin already dynamically modifies the item's lore, maybe it could be possible to also dynamically remove the lore again when the player moves the item from his inventory into some other inventory (eg. a shop chest). And once a player buys the item from the shop (i.e. it gets moved by the shopkeepers plugin into the player's inventory, the QuantumRPG plugin would have to somehow detect this (maybe by periodically checking a player's inventory items) and re-add the player-specific lore again.
Edit: Or clear/reset the lore when a player opens the trading interface, since some trading actions also need to check for matching items inside the player's inventory.
Another alternative could maybe be to for QuantumRPG to handle the player-specific lore via packet manipulations: Whenever the data of an item is sent to a client, the plugin could replace placeholders / inject the player-specific lore into the item's packet data, so that the item appears to have a certain lore. However, I am not completely sure if this works, since like I said the client will do these item comparisons as well and not display the item in the result slot of the trading interface if the items don't match. So the plugin would have to either exclude items that are part of the trading interface, or also manipulate the information that is sent about the villager's trades. All of this is a new source for weird client-server desyncing issues.