Ability to rollback items to their previous durability/state exactly
GenSecrets opened this issue ยท 8 comments
Currently when any items are rolled back (armor/items/tools/etc) they're all rolled back at full durability. While this is a great convenience feature I suggest there be a toggle for sake of larger servers like mine.
Why
We receive numerous tickets a week regarding needing items rolled back because they were lost or disappeared. Because of the intentions of some RPG or sentient items, we do not refund them if they naturally broke due to low durability. Because of this, in non-obvious situations we used to rollback the item, check it's durability, then run quick math based on blocks broken/mobs hit/etc to determine how close durability was or if it broke naturally or really disappeared. After transition to 1.15.2 this is no longer possible
Another instance is because of some custom plugins we have where we have item trades heavily dependent on exact durability (i.e. a "relic" that can be exchanged for gold, but the "relic" is old and fragile, this having 1 durability so that it can't be used, only traded if found.
Implementation
Ideally this would be a config line-item "repair-items-on-rollback:true/false" or similar. If false it would not repair items and would rollback items exactly as they were at the state they're being rolled back from. If true it would default to always repairing the items. This would require the database to save the state of the item exactly if it doesn't already.
There would also be two in game flags "-no-repair" and "-repair" to be run in rollback commands which would override the config and either repair or not repair per request. This would be dependent on the person having a permission "prism.repair" to be able to use the flags, similar to drain, extinguish, override, etc.
So are you saying that currently items are not rolled back at the old level of damage?
So are you saying that currently items are not rolled back at the old level of damage?
Correct, currently all items when rolled back they are returned at full durability, not the durability they should be at
Additionally this brings up the issue that Prism does not currently track ITEM breakage.
but conversely it should not rollback that event either - so there is no current ability to rollback items that break naturally.
We would need to add tracking to https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerItemBreakEvent.html
Right, agreed. The main thing I'm referencing is that should we roll back a removal from a chest (for example): If the item had 50% durability in the chest, once the removal is rolled back, it rolls back the same item but at 100% durability. In the older versions of prism (particularly minecraft 1.12.2 that I can remember) it would roll back at exact durability rather than fully repaired
I think this might have been fixed in #109
Can you confirm using Release 2.1.6