-1

I`m tried to get the command which executes when i click an npc on my server. How can i get this command?

I tried to use some modded client to get it but it didnt helped.

pppery
  • 3,731
  • 22
  • 33
  • 46
VanProBRO
  • 11
  • 4

1 Answers1

0

There is not a direct event for that, but you can use "PlayerInteractEntity" and compare if the clicked entity is a Villager or whatever NPC you want.

Something like this:

@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent e) {
    Entity ent = e.getRightClicked();
    
    if (ent instanceof NPC){
    // Do whatever
    }
}
SandAx3r
  • 26
  • 3