#(pikibanana) NPCRightClickEvent firing twice.
28 messages · Page 1 of 1 (latest)
(pikibanana) NPCRightClickEvent firing twice.
Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
@EventHandler(priority = EventPriority.HIGHEST)
public void onRightClick(NPCRightClickEvent e) {
Main.getMain().getLogger().info("NPCRightClickEvent triggered");
if (e.isCancelled()) {return;}
Player player = e.getClicker();
NPC npc = e.getNPC();
if (npc.hasTrait(AlchemistTrait.class)) {
sendClickableOptions(player);
}
}```
@TraitName("alchemist")
public class AlchemistTrait extends Trait implements Listener {
public AlchemistTrait() {
super("alchemist");
}```
PlayerInteractEntityEvents often fire twice
I would follow any of the many strategies that exist for that, see paper discord etc
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@icy blade
Can you maybe send some of them here, I don't want to join another discord server if possible (close to the limit of 100).
Unfortunately this is not a citizens specific issue, you would be much better off looking at general strategies for coding your plugin which would be the paper discord. I think if you have any minecraft plugin development questions it would be good to join anyway
Thread closed as resolved.
I have tried looking in there and found nothing that really worked do you maybe have some of your own suggestions on how I should do it?
Thread was manually reopened by @icy blade.
This is not a coding help discord
Try asking in #paper-dev
Thread closed as resolved.
@icy blade just re-read your code and I see the misunderstanding
Thread was manually reopened by @rancid ledge.
if you put your event listeners in the trait class it will fire once per trait instance
Could you explain a bit further, there is only 1 npc with the trait and I think I only registered it once
I registered it as a listener and as a trait
Solved it thanks! I just didn't need to also register it as a listener
Just with the trait factory
oh yes