You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm essentially trying to create a bot that automatically kicks a player from the server when they join (without operator permissions)
When I run it, it kicks the player at first, but then, once the player rejoins, they don't get kicked anymore and the code proceeds to give this error:
constmineflayer=require("mineflayer")bot=[]error_handler=[]functioncreateBot(){console.log("bot made")bot[0]=mineflayer.createBot({host: "<my ip>",port: 43274,username: "<username of person who i aim to get kicked>",});bot[0].on("error",(err)=>{console.log(err);createBot();});bot[0].on("end",()=>{console.log("reconnecting..");createBot()});}createBot();// Everything after this is irrelevant to the error (i think)functionlookAtNearestPlayer(){constplayerFilter=(entity)=>entity.type==="player";constplayerEntity=bot[0].nearestEntity(playerFilter);if(!playerEntity)return;constpos=playerEntity.position.offset(0,playerEntity.height,0);bot[0].lookAt(pos);}bot[0].on("physicTick",lookAtNearestPlayer);
Expected behavior
I expect it to kick the player whenever they rejoin the server.
The text was updated successfully, but these errors were encountered:
This is caused by the server or something in your network between you and the server. Basically you are being disconnected by someone, and if it's the server, they are closing your connection without sending a Minecraft kick packet. You can't fix this in your code until you figure out if it's the server or the network, so check the server logs and see if you can reproduce on another Minecraft server.
Versions
Detailed description of a problem
I'm essentially trying to create a bot that automatically kicks a player from the server when they join (without operator permissions)
When I run it, it kicks the player at first, but then, once the player rejoins, they don't get kicked anymore and the code proceeds to give this error:
My current code
Expected behavior
I expect it to kick the player whenever they rejoin the server.
The text was updated successfully, but these errors were encountered: