I’m currently creating a plugin that allows hoes to bypass claims in order to harvest food (but automatically replants)
At the moment I’ve got this working well on right click (Prevents accidental destruction of crops when not in protected land) But wanted to also mimic this functionality on left click.
If I listen to UseItem event I have free reign over durability changes, but no easy way to get the target block.
If I listen to block break event, it’s hard to guarantee using API contract that the changes I make to the items / blocks will hold.
If I listen to InteractBlockEvent.Primary I can modify the block as well as the item stack, but doesn’t truly simulate the item use correctly.
I’m interested to know how others would approach this problem and what they think the pros and cons of each method would be.
Ideally I would have the behaviour injected into the hoe item, but that’s approaching mod territory and further away from what sponge can handle, especially given that I want to bypass cancelled events.