Closed PlagueisTheWise21 closed 3 years ago
that event is just a passthrough of the entity click event, and already has the offhand check https://github.com/CitizensDev/Citizens2/blob/master/main/src/main/java/net/citizensnpcs/EventListen.java#L480-L492
Your event is likely double-firing because you have it in a Trait instance and aren't checking that the NPC in the event is the one for the trait... trait events are automatically registered per each NPC the trait is attached to. (Also, if you register events on a trait class in your own code, that will also cause duplication)
I'm using the CitizensAPI in my plugin and when adding an NPCRightClickEvent to a custom trait, the event triggers twice. I know this occurs on normal Spigot on PlayerInteractEvents and the way to solve this is to check what hand interacted for the event: if (e.getHand() == EquipmentSlot.HAND) { but with the NPCRightClickEvent there is no method that returns an EquipmentSlot enum.
I've tried searching online for fixes for this and unable to figure out what is going wrong and how to fix it.
Here is my trait class: https://pastebin.com/LzMesu7F
The output of command
/version
on my server is: Refer to below image The output of command/version citizens
on my server is: Refer to below image