
Command
/publish
Opens the current singleplayer world to other players on the local network.
| /publish [<allowCommands> [<port>]] |
| Argument | Kind of value | What to type |
|---|---|---|
| <allowCommands> | True or false | true or false: whether players who join may use commands. Default false. |
| <port> | Whole number | The network port to host on, from 0 to 65535. Left out, a free port is chosen. |
| Permission level | 4: server owners and the server console |
| Works in | Singleplayer only: the command does not exist on dedicated servers. Needs permission level 4 (owners), which only the world's owner has, and only when cheats are enabled. Command blocks and functions cannot run it (their permission level is 2). |
| Result | Reports "Local game hosted on port <port>". The number /execute store saves is the port number. |
| Defaults | Without arguments a free port is picked automatically and joining players are not allowed to use commands. |
| Guest commands | With allowCommands set to true, players who join get permission level 2, as long as cheats are enabled in the world. |
| Already open | If the world is already open the command fails with "Local game is already hosted on port <port>". If the port cannot be opened it fails with "Unable to host local game". |
/publishOpens the world to the local network on a free port.
/publish true 25565Opens the world on port 25565 and lets joining players use commands.

