Every time I open my world to LAN, people join and start destroying stuff. I want to ban them, but every time I ask someone for help they can't ban them.
84 Answers
I don't believe it's possible to ban players on LAN, but you could instead set up a command block to constantly kill them:
Give yourself a command block and change it to Repeat and Always Active:
You can then set the command to /kill <PLAYER>, and it should repeatedly kill them, making them unable to do anything.
If your chat gets spammed with [@: Killed Player] from this, turn off the commandBlockOutput gamerule:
/gamerule commandBlockOutput false 9 You could set up a whitelist on the server. It's a bit more work than just banning those who do harm, but it means that you have full control in who's allowed to join your server. Hopefully keeping those griefers at bay.
For this to work you need to have created your LAN world first, and then exit the game. After you've done that, you can check the wiki for the whitelist commands.
In short. To enable the whitelist just write /whitelist on in the chat, and then /whitelist add <username> to allow players to join.
Note that I haven't tried this for a LAN server, but it should be just the same as for a dedicated one.
3Assuming that you are talking about LAN play, Ensure that your device is not connected to the network. e.g. turn off Wi-fi.
For a LAN world (Local area network), it is impossible (except maybe with mods) to actually ban specific players. I would do a command string something like this, where it kills all players instantly except the people you want on the world (be sure to do these commands in order). Do this command on a repeater/chain command block string for everyone you want allowed to play:
scoreboard players tag @a[name={player name}] add good
Example:
scoreboard players tag @a[name=4llen] add good
Next, once you have accounted for all players you want allowed, do the following command:
kill @a[tag=!good]