Stop sharing the world
/unpublishCloses the world to new players; you keep playing on your own.

/unpublish closes a world that you opened to other players with /publish or the Open to LAN button. It was added in 26.2 and, like /publish, needs level 4 in a singleplayer world with cheats on.
/unpublish// Only in single player: the command does not exist on a dedicated server.
/unpublishCloses the world to new players; you keep playing on your own.
Fill in the fields, then copy the command.
Command generatorThe game answers Multiplayer game is now unpublished and new players can no longer join. Before this command existed, the only way to stop sharing a LAN world was to leave it. If the world was not shared, the message is No multiplayer game published.
To open it again with other settings, for example without cheats for guests, run /publish. To remove a single guest and keep the world open, /kick is enough. Your own game is not interrupted: the world stays open for you.
✓ Checked in Java Edition 26.3 · updated 2 November 2026
No. You keep playing in your world; only the sharing with other players stops.
The world was not open to other players. Use /publish or Open to LAN first.
Type it in a single-player world with cheats on: /unpublish. It does not exist on a dedicated server.
Single player with cheats on, level 4. Only in single player: the command does not exist on a dedicated server.
It is in the official command tree since Java Edition 26.2.