17

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.

8
  • 4
    Are you just wanting to have a world that anyone can join, or just for specific friends? If the latter, then you can whitelist those accounts and nobody else but those people can join the server.
    – Tim Reddy
    Commented Oct 17, 2016 at 17:09
  • 3
    I 2nd @immibis, which people are you referring to? If you are opening your minecraft world up to a LAN you "should" not be open to the Internet unless you had a NAT rule (i.e. port forward) setup to send traffic to your host. Commented Oct 17, 2016 at 21:22
  • 8
    Are you playing on a school's internet? (Or some other large-scale network?) Thats the only situation I can think of where random people on your LAN would want to mess with random MC worlds unless you have some really mean siblings or something... Why do you WANT to be open to LAN? Playing with a few specific friends? Is it random griefers or the same ones every time? Commented Oct 17, 2016 at 22:34
  • 4
    It sounds like you should just set up a server... you don't have to port forward, but it will allow you to ban people.
    – MCMastery
    Commented Oct 17, 2016 at 23:02
  • 2
    just came here to +1 for the title: block people from minecraft. Commented Oct 18, 2016 at 15:06

4 Answers 4

29

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:

Command block killing the player

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
  • 54
    Violence is the answer.
    – Timmy Jim
    Commented Oct 17, 2016 at 14:43
  • 1
    What about /kill @a[name=!<Player>]
    – user143228
    Commented Oct 17, 2016 at 17:39
  • 6
    @RudolfL.Jelínek I'm guessing they want to ban certain people and still have friends play on LAN, rather than banning everyone but themself.
    – SirBenet
    Commented Oct 17, 2016 at 18:18
  • @colorfusion So what about using scoreboards to select "friends" and "non-friends", which will be killed?
    – user143228
    Commented Oct 17, 2016 at 18:32
  • 2
    @colorfusion We don't yet know if random players, or the same ones keep joining in. That's the problem, I guess - making a command block for each player..
    – user143228
    Commented Oct 17, 2016 at 19:15
10

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.

3
  • Agreed. Your server, LAN or otherwise, should always have a whitelist (not a blacklist, it's impossible to ban everyone bad). That way you always know who has create permissions on your server. Commented Oct 18, 2016 at 11:50
  • Currently, the link to the guide leads to a 404 Not Found error web page. Commented Jul 17, 2019 at 2:58
  • @galacticninja Thanks for the notice. I've fixed it now.
    – ChristianF
    Commented Oct 2, 2019 at 19:47
0

Assuming that you are talking about LAN play, Ensure that your device is not connected to the network. e.g. turn off Wi-fi.

0

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]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .