Closed amoraschi closed 4 years ago
Citizens 2 creates fake players and names them as NPCs. Thus mineflayer thinks they are actual players. I don't think there is a way to differentiate them. You can check all of the fields of one NPC, and of one player character, compare them and find some field(s) that will let you mark player as NPC in your code and then ignore it.
So it doesn't spam the console? Is it due to
playerJoined
andplayerLeft
? Or some other event that you're logging?
Oh, yeah it spams the console. It spams:
[npcName] has joined [npcName] has left
It's like as the npc's where leaving and joining
What is possible to do is to get their UUID, and check them against mojang API, if they don't exist, ignore them
Could you make/write an example? I think I'm not pro enough to do that
Use this
Mojang API : https://wiki.vg/Mojang_API (ex : https://api.mojang.com/user/profiles/069a79f444e94726a5befca90e38aaf5/names -> notch UUID)
Node JS http : https://nodejs.org/api/http.html + https://nodejs.org/en/knowledge/HTTP/clients/how-to-create-a-HTTP-request/
There is an example in the third link
Thanks!
Versions
Detailed description of a problem
When the bot joins, it thinks that the NPC of the Citizens2 for 1.16.1 are actual players, is there a way to prevent this? So it doesn't spam the console?
Your current code
Expected behavior
Bot ignores NPC's of other plugins.