prism / PrismRefracted

A continuation of Prism, a change-tracking plugin for Bukkit-based servers.
Other
43 stars 23 forks source link

[BUG] Resolved Written Book item action may not rollback/restore #61

Open Rothes opened 1 year ago

Rothes commented 1 year ago

Describe the bug This has been an issue since Spigot 1.8. Written Book has a attribute resolved(Boolean Type), which we can't get and set from Bukkit API(The API will be added for Spigot 1.20+). A exist written book that has been opened once by a player, the resolved attribute is always true. Creating a new Written Book ItemStack, the resolved attribute is null. And we can't set it with Bukkit API(Beyond open the created book for a player). So, comparing these two item isSimilar will always return false, and rb/rs is going to be skipped. E.g. breaks here https://github.com/prism/PrismRefracted/blob/917eead38d3500d1678c96c57bd334e7052d89b1/Prism/src/main/java/network/darkhelmet/prism/actions/ItemStackAction.java#LL391C38-L391C47 A possible fix it to use NBTAPI to record/set the resolved nbt of item.

Server